Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django - Site matching query does not exist

Im trying to get the admin site of my app in Django working. Ive just sync`d the DB and then gone to the site but I get the error ...

Site matching query does not exist.

Any ideas ?

like image 498
felix001 Avatar asked Apr 17 '13 19:04

felix001


3 Answers

Every django app needs a Site to run. Here you do not seem to have it.

Log into 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 should be all set.

like image 159
karthikr Avatar answered Nov 20 '22 08:11

karthikr


Add django.contrib.sites in django INSTALLED_APPS and also add SITE_ID=1 in your django setting file.

like image 35
Mr Singh Avatar answered Nov 20 '22 09:11

Mr Singh


Adding SITE_ID=1 on settings.py did the trick for me.

like image 19
Cesar Gamboa Avellan Avatar answered Nov 20 '22 09:11

Cesar Gamboa Avellan