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
This method didn't work for me. I encountered a lot of errors. Also loaddata will consume a lot of memory. What worked for me was to run sequel from ruby. Just run the commands:
gem install sequel
You will need to have installed on your system the devel packages for postgres , sqlite and ruby
Run the command:
gem install pg sqlite3
Create an empty database on postgresql, let's say testDB and assign a grant permission to a user
From the command prompt run:
sequel -C sqlite:///path/to/sqlitedb.db postgres://user:password@host/testDB
This will run with no errors.
Change the settings in your django project to work with the postgres database
Run
./manage migrate (not necessary)
Run the server