What should I use instead of syncdb in Django 1.9?
Take a look at this:
$ pypy ./manage.py syncdb /usr/lib64/pypy-2.4.0/site-packages/django/core/management/commands/syncdb.py:24: RemovedInDjango19Warning: The syncdb command will be removed in Django 1.9 warnings.warn("The syncdb command will be removed in Django 1.9", RemovedInDjango19Warning) (cut)
I ran a quick google search, but could not find the answer - what should I be using instead of
Now you can track your changes using
makemigrations. This transforms your model changes into python code to make them deployable to another databases. When you have further modifications you need applied to the database, you can use data migrations.
After you created the migrations you have to apply them:
So instead of using
syncdb you should use
makemigrations and then
Workflow on development after you changed something in your models:
./manage.py makemigrations ./manage.py migrate
And on your production system:
Bonus: you do not need to run
migrate for each change. If you have multiple changes not applied yet django will run them in the correct order for you.
★ Back to homepage or read more recommendations: