Django DatabaseError: relation "django_site"

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

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


I can't see your models or what apps are you using, but my guess is that you are using django_site (Site model) and you don't have 'django.contrib.sites' in the INSTALLED_APPS.

If I'm correct then just add 'django.contrib.sites', to your INSTALLED_APPS.


This issue continues to plague many, including myself. Although a tedious process, this approach saves me the brain power:

Disable all external apps in your INSTALLED_APPS, except your own apps, like so:

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.sites',
    'django.contrib.flatpages',
    'main', # This is my own app.

    # 'compressor',
    # 'ckeditor',
    # 'imagekit',
    # 'debug_toolbar',
    # 'rest_framework',
    # 'allauth',
    # 'allauth.account',
    # 'allauth.socialaccount',

    # 'allauth.socialaccount.providers.google',
    # 'allauth.socialaccount.providers.facebook',
)

Run

python manage.py makemigrations
python manage.py migrate

Then, uncomment all the other apps, then repeat makemigrations and migrate above.

That works all the time for me