Django and Databases
Updating database structure[edit]
Workflow [1][edit]
After changing the structure of a model in the Django code,
$ python manage.py makemigrations $ python manage.py migrate
Editing models in a reusable package/app[edit]
Edit models.py in the package.
Repackage the app (from within the root package directory).[2]
$ python setup.py sdist
Update the package/app (See also Reusable Django Packages/Apps), e.g:
$ pip uninstall django-contact_info $ pip install ~/develop/labs/shared/django-addresses/dist/django-contact_info-1.2.1.tar.gz
Make migrations in the Django project.
$ cd /path/to/django/project/ $ python manage.py makemigrations contact_info $ python manage.py migrate contact_info
Notes[edit]
- ↑ Migrations - Django Documentation (v1.8)
- ↑ How to Write Reusable Apps - Django Documentation