Error Getting Site Matching Query Does Not Exist Error after creating django admin

+1 vote

 I'm creating an admin for an app. After commenting the admin related stuff in settings and running syncdb I'm getting this message:

DoesNotExist at /admin/ Site matching query does not exist.

Can anyone help me figure this out?

Jun 22, 2020 in Python by kartik
• 37,520 points
12,550 views

1 answer to this question.

0 votes

Hello @kartik,

The Site object for your Django project is missing. Each Django project has a Site object which contains the site's name and domain. It is usually automatically created when creating a Django project  but in your case it seems that didn't happen.

To fix it:

Open the Django shell for your site (python manage.py shell).

Type the following:

>>> from django.contrib.sites.models import Site
>>> Site.objects.create(name='example.com', domain='example.com')

If you want to change these values later, go to your admin panel (/admin/) and edit the site object in the section Sites.

Hope this is helpful!!

Thank You!

answered Jun 22, 2020 by Niroj
• 82,840 points

Related Questions In Python

0 votes
1 answer
+1 vote
1 answer

Django not found error

Before installing Django make sure you have ...READ MORE

answered Jun 24, 2019 in Python by Fata
• 1,050 points
2,670 views
0 votes
0 answers

Python error "ERROR: Can not perform a '--user' install. User site-packages are not visible in this virtualenv."

I tried upgrading pip using the following ...READ MORE

Oct 3, 2019 in Python by Hannah
• 18,520 points
6,056 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,443 views
0 votes
1 answer
+5 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,790 points
4,078 views
0 votes
1 answer

Error:django-debug-toolbar breaking on admin while getting sql stats

Hello @kartik, You just need to be able ...READ MORE

answered Jun 12, 2020 in Python by Niroj
• 82,840 points
1,271 views
0 votes
1 answer

Errors in fields not displaying on Django admin form?

Hiii, Here is how you can see what ...READ MORE

answered Apr 29, 2020 in Python by Niroj
• 82,840 points
4,657 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP