How to copy database in use to other database in django?

First, execute

manage.py dumpdata > out.json

then change your DB config, migrate (or syncdb) and finally

echo "delete from auth_permission; delete from django_content_type;" | python manage.py dbshell

(If you have Django older than 1.11, you need to use

echo "delete from django_content_type;" | manage.py dbshell

)

Then load the JSON file:

manage.py loaddata out.json

(as of 2013 django_contenttype is replaced with django_content_type)


I am trying to do the same exact thing right now, but I am running into a problem with resolving dependencies basically the same as ticket 16317. But enough about me...

Troubleshooting this led me to find a link for django-smuggler which allows you to create dumps and load data from the admin interface.

It looks promising for any data transfer needed or to use as a backup utility.


If you get errors when loading the data, first dump it like this:

python manage.py dumpdata --exclude auth.permission --exclude contenttypes > datadump.json

as described here:

http://www.denzow.me/entry/2017/09/06/223517