Skip to content

Instantly share code, notes, and snippets.

@viseshrp
Forked from sirodoht/migrate-django.md
Last active June 24, 2019 15:43
Show Gist options
  • Save viseshrp/49ddcc79861dfa202900fa904de21d15 to your computer and use it in GitHub Desktop.
Save viseshrp/49ddcc79861dfa202900fa904de21d15 to your computer and use it in GitHub Desktop.
How to migrate Django from SQLite to PostgreSQL

How to migrate Django from SQLite to PostgreSQL

Dump existing data:

python3 .\manage.py dumpdata --indent 2 --natural-primary --natural-foreign -o dump.json

[...........................................................................]

Change settings.py to Postgres backend.

Make sure you can connect on PostgreSQL. Then:

python3 .\manage.py migrate --run-syncdb

Finally:

python3 .\manage.py loaddata dump.json -i

Installed 420 object(s) from 1 fixture(s)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment