Django and Databases
Updating database structure
Workflow [1]
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
models.pyin the package. - Repackage the app.[2]
python setup.py sdist(from within the root package directory)
- Update the package/app, e.g:
$ pip uninstall django-addresses $ pip install ~/develop/labs/shared/django-addresses/dist/django-addresses-1.2.1.tar.gz
- (See also Reusable Django Packages/Apps)
Notes
- ↑ Migrations - Django Documentation (v1.8)
- ↑ How to Write Reusable Apps - Django Documentation