Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django: relation "django_site" does not exist

Tags:

python

django

I am running a test django server on aws and I just installed django-userena and when I try to signup a user upon clicking submit, I get the following message:

relation "django_site" does not exist LINE 1: ..."django_site"."domain", "django_site"."name" FROM "django_si...

I am not really sure what went wrong here. I did some researching and added " 'django.contrib.sites'," to my installed apps, but I am still getting the error. I will there is an extra step I am missing. Any suggestions or advice?

like image 922
RedShirt Avatar asked May 29 '14 04:05

RedShirt


3 Answers

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
like image 91
Franey Avatar answered Oct 20 '22 23:10

Franey


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

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

like image 35
Geo Jacob Avatar answered Oct 21 '22 00:10

Geo Jacob


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
    
like image 10
Saeed Gharedaghi Avatar answered Oct 21 '22 01:10

Saeed Gharedaghi