Back to Browse

How to troubleshoot Django errors when migrating sqlite database to postgres

1.3K views
Mar 6, 2022
14:59

Overcome integrity, duplicate keys, and contenttype errors when attempting a database migration from sqlite to postgres for a Django project. ## Troubleshooting To overcome this error django.db.utils.ProgrammingError: relation "blog_category" does not exist Uncomment line in forms.py so that categories are not fetched before the table is created To overcome this error django.db.utils.IntegrityError: Problem installing fixture Could not load contenttypes.ContentType Remove auto added contenttypes from django for loading data $ python3 manage.py shell from django.contrib.contenttypes.models import ContentType ContentType.objects.all().delete() If you run into this error: Key (id)=(1) already exists try commenting out pre-save methods (signals.py) Timestamps 5:00 - Table does not exist 9:12 - Key already exists 10:43 - Another Key already exists error

Download

0 formats

No download links available.

How to troubleshoot Django errors when migrating sqlite database to postgres | NatokHD