Django and Databases: Difference between revisions

From Littledamien Wiki
Jump to navigation Jump to search
(Created page with "Category:PostgreSQL Category:Django Category:Python Category:Web Development == Updating database structure == === Workflow <ref>[https://docs.djangoproject.c...")
 
Line 21: Line 21:
$ pip install ~/develop/labs/shared/django-addresses/dist/django-addresses-1.2.1.tar.gz
$ pip install ~/develop/labs/shared/django-addresses/dist/django-addresses-1.2.1.tar.gz
</syntaxhighlight>
</syntaxhighlight>
** (See also [[Reusable Django Packages/Apps]])
:* (See also [[Reusable Django Packages/Apps]])


== Notes ==
== Notes ==
<references />
<references />

Revision as of 18:02, 1 September 2015

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