Django - site compliance request does not exist

I am trying to get the admin site of my application to work in Django. I just synchronize the database, and then went to the site, but I get an error ...

Site matching query does not exist.

Any ideas?

+5
source share
3 answers

For each application, django is required Siteto run. Here it doesn’t look like you.

Enter your django shell

$> ./manage.py shell
>>> from django.contrib.sites.models import Site
>>> site = Site()
>>> site.domain = 'example.com'
>>> site.name = 'example.com'
>>> site.save()

or

$> ./manage.py shell
>>> from django.contrib.sites.models import Site
>>> site = Site.objects.create(domain='example.com', name='example.com')
>>> site.save()

You must be tuned.

+22
source

You also need to make sure that the domain of the site matches the one you are using. For example, if you are a user of access to the admin site from http://127.0.0.1:8000/admin/ , then your site.domain should be: site.domain = '127.0.0.1 :. 8000

+4

Add django.contrib.siteto django INSTALLED_APPSand also add SITE_ID=1django to the configuration file.

+1
source

All Articles