top of page

Python Assignment Help - How Migrate a Django DB from SQLite to MySQL or PostgreSQL? | DB Migration



Step 1:

Creating Dump file of existing data.


>python3 manage.py dumpdata>datadump.json


Step:2

Change settings.py to Postgres backend.


Step3:

Make sure you can connect on PostgreSQL. Then:


Step4:

python3 manage.py migrate --run-syndb


Step5:

Run this on Django shell to exclude contentype data


>python manage.py shell


>>> from django.contrib.contenttypes.models import ContentType

>>> ContentType.objects.all().delete()

>>> quit()


Finally load data by using this


>python3 manage.py loaddata datadump.json



If you like Codersarts blog and looking for Programming Assignment Help Service,Database Development Service,Web development service,Mobile App Development, Project help, Hire Software Developer,Programming tutors help and suggestion  you can send mail at contact@codersarts.com.

Please write your suggestion in comment section below if you find anything incorrect in this blog post


bottom of page