Migrations in Django 1.7

穿精又带淫゛_ 提交于 2019-12-03 21:03:07

If you are adding initial migrations to an app, you must include the app name when using the makemigrations command.

python manage.py makemigrations your_app_label

If it is the first time you are migrating that app you have to use:

manage.py makemigrations myappname

Once you do that you can do:

manage.py migrate

If you had your app in database, modified its model and its not updating the changes on makemigrations you probably havent migrated it yet. Change your model back to its original form, run the first command (with the app name) and migrate...it will fake it. Once you do that put back the changes on your model, run makemigrations and migrate again and it should work.

I have sometimes the same problem. I manage to populate the change in the database by following :

rm -rf your_app/migrations/*

python manage.py migrate

if it doesn't work, consider a manual drop table before, if you don't have data in it.

it worked for me with django 1.7c1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!