Dump existing data:
python3 manage.py dumpdata > datadump.json
Change settings.py to Postgres backend.
Make sure you can connect on PostgreSQL. Then:
python3 manage.py migrate --run-syncdb
Run this on Django shell to exclude contentype data
python3 manage.py shell
>>> from django.contrib.contenttypes.models import ContentType
>>> ContentType.objects.all().delete()
>>> quit()
Finally:
python3 manage.py loaddata datadump.json
To not found error when use
loaddata
to load fixture, excludecontenttype
andauth.Permission
modules. So the dump line will be:python manage.py dumpdata --exclude=contenttypes --exclude=auth.Permission > datadump.json
I found this help on: https://coderwall.com/p/kogbla/django-fixture-dumpdata-loaddata-and-integrity-error