[Answered ]-Django admin error

3👍

Your SITE_ID setting’s value likely does not correspond with the primary key of a Site object. You can verify by running this:

$ ./manage.py shell
Python 2.7.1 [...]
>>> from django.contrib.sites.models import Site
>>> from django.conf import settings
>>> Site.objects.get(pk=settings.SITE_ID)
<Site: example.com>

If the response of the final command is not a Site object (it’d likely raise a Site.DoesNotExist exception), then that’s the problem. You can solve it by not setting SITE_ID, which is unnecessary if you are not using django.contrib.sites.

-1👍

I know this might sound weird, but I saw an error like this once. Try removing django.contrib.sites. It was colliding with another app that the person had installed.

Leave a comment