Django 1.8 migrate: django_content_type does not exist

AliBZ picture AliBZ · Sep 17, 2015 · Viewed 8.6k times · Source

I just upgraded my django from 1.7.1 to 1.8.4. I tried to run python manage.py migrate but I got this error:

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

I dropped my database, created a new one, and ran the command again. But I get the same error. Am I missing something? Do I need to do something for upgrading my django?

EDIT: I downgraded back to 1.7.1 and it works. Is there a way to fix it for 1.8.4?

Answer

Ashok Joshi picture Ashok Joshi · Sep 17, 2015

Delete all the migration folder from your app and delete the database then migrate your database......

if this does not work delete django_migration table from database and add the "name" column in django_content_type table ALTER TABLE django_content_type ADD COLUMN name character varying(50) NOT NULL DEFAULT 'anyName'; and then run $ python manage.py migrate --fake-initial