Django: relation "django_site" does not exist

I recently ran into this issue (Django 1.8.7) even with SITE_ID = 1 in my settings. I had to manually migrate the sites app before any other migrations:

./manage.py migrate sites
./manage.py migrate

I have the same problem and fixed it like this:

  1. add SITE_ID=1 into settings.py
  2. run this command :

    python manage.py migrate
    

You may be calling a site object before creating site model(before syncdb or migrate)

ex: site = Site.objects.get(id=settings.SITE_ID)

Tags:

Python

Django