$ python manage.py dump2py 20130117
This will create a directory 20130117 with a set of ` .py` files which are a perfect representation, in Python, of your database at that moment. These files contain a complete backup of your database. You can archive the directory and send it around per email.
$ python manage.py run mydump/restore.py
Or, if you don’t use per-project
$ set DJANGO_SETTINGS_MODULE=myproject $ django-admin.py run mydump/restore.py
Note about django-extensions¶
has a command “dumpscript” which is comparable to
The most important different is that the Python code
is designed in order to make it possible to
write automated database migrations.
Models that get special handling¶
ContentType objects aren’t stored in a dump because they can always be recreated.
Site and Permission objects must be stored and must not be re-created
Session objects can get lost in a dump and are not stored.