您的位置:首页 > 数据库

django修改models重建数据库

2016-04-27 18:28 393 查看
第二次修改models.py以后再次
python manage.py makemigrations
提示如下
You are trying to add a non-nullable field 'address' to xc_users without a default; we can't do that (the database needs something to populate existing rows). Please select a fix:  1) Provide a one-off default now (will be set on all existing rows)  2) Qu
于是删除数据库表,继续报相同的错误
makemigration需要指定名称,然后migrate才能识别两次<span style="font-family: Arial, Helvetica, sans-serif;">makemigrations的不同</span>
python manage.py makemigrations --name sqlname
然后再执行:
python manage.py migrate
成功解决问题
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: