cjahangir
cjahangir

Reputation: 1797

Migration in Postgresql and Django 1.8

In my project I am using django 1.8 and for a fresh project if I run

python manage.py runserver

it shows the following message:

You have unapplied migrations; your app may not work properly until they are applied. Run 'python manage.py migrate' to apply them.

Then if i run the command

python manage.py migrate

it works fine for sqlite. But if i connect with postgresql in my local_settings.py and run the above migration command then it gives the following error:

django.db.utils.ProgrammingError: relation "django_content_type" does not exist

Upvotes: 0

Views: 611

Answers (1)

voodoo-burger
voodoo-burger

Reputation: 2153

You probably have an app that has a (generic) foreign key to ContentType. This causes migrations to fail because the database tries to create a foreign key to a table that doesn't exist yet. Try migrating contenttypes first with python manage.py migrate contenttypes and then applying your other migrations.

Upvotes: 1

Related Questions