When you configure your brand new Django project you’ll see in your settings something like:
SITE_ID = 1
That ID refers to the Django “sites” framework. If you plan on using the admin interface make sure that ID exists in the database, otherwise you’ll get an error:
DoesNotExist at /admin/
Site matching query does not exist.
Request Method: GET
Request URL: http://localhost:8000/admin/
Django Version: 1.3
Exception Type: DoesNotExist
Exception Value:
Site matching query does not exist.
If it doesn’t exist, create it:
>>> from django.contrib.sites.models import Site
>>> site = Site()
>>> site.domain = 'example.com'
>>> site.name = 'My website'
>>> site.save()
>>> site.id
3
That’s the ID you should use in your settings file:
SITE_ID = 3



