[Fixed]-Django project Migration from SQL lite to postgres โ€“ relation "django_content_type" does not exist

0๐Ÿ‘

โœ…

So after playing around it started to work.
Solution was that I havent added the server to pgAdmin https://www.pgadmin.org/

I was under assumptions that pgadmin is just a tool to see whats going on but without adding postgre to pgadmin the migration had errors.

๐Ÿ‘คIlya Bibik

1๐Ÿ‘

Your DATABASES section in settings.py should be like:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'yourdb',
        'USER': 'youruser',
        'PASSWORD': 'yourpass',
        'HOST': '',
    },
}

Your INSTALLED_APPS should include psycopg2
Once this in place and server restarted, you can remigrate, which should create the missing table

๐Ÿ‘คdmitryro

0๐Ÿ‘

django_content_type should be created automatically.
Iโ€™m wondering how did you do your makemigrations
Maybe try

python manage.py makemigrations

instead of doing them one by one

๐Ÿ‘คI. Xue

Leave a comment