Wednesday, March 5, 2014

Site matching query does not exist -- Django

Background: 

When migrating from sqlite3 to postgresql, after running

python manage.py syncdb

got error message “Site matching query does not exist.

The cause: 

Table django_site does not have any entry.

The fix: 

python manage.py shell
from django.contrib.sites.models import Site
Site.objects.all()
Site.objects.create(pk=1, domain='127.0.0.1:8000', name='localhost'

Credit : 
http://stackoverflow.com/questions/6957360/admin-login-stopped-functioning-django

No comments:

Post a Comment