django修改models重建数据库

第二次修改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才能识别两次makemigrations的不同

python manage.py makemigrations --name sqlname

然后再执行:
python manage.py migrate
成功解决问题


你可能感兴趣的:(python)