Django and Databases

From Littledamien Wiki
Revision as of 18:01, 1 September 2015 by Video8 (talk | contribs) (Created page with "Category:PostgreSQL Category:Django Category:Python Category:Web Development == Updating database structure == === Workflow <ref>[https://docs.djangoproject.c...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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.py in 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

Notes

  1. Migrations - Django Documentation (v1.8)
  2. How to Write Reusable Apps - Django Documentation