[Django]-Django project /admin Site matching query does not exist

8πŸ‘

βœ…

It seems the SITE_ID setting in your settings file is pointing to an ID that doesn’t exist in your database.

You either need to create a new site in the sites model (via admin) and change the ID in the settings file to match that one, or re-insert the item via SQL and give it the same ID as your settings file.

πŸ‘€Llanilek

0πŸ‘

This problem will always seem to occur continually, so if you don’t want to serve your model with multiple sites, then I suggest you remove the SITE_ID from the setting file. Note this worked for me!

πŸ‘€Okayjosh

-1πŸ‘

I just had to remove the 'django.contrib.sessions' from INSTALLED_APPS in settings.py as it was causing problems and I was using this project only for one site.

However, if you are using your project for multiple different sites and need the Django sites framework, please check SITE_ID in your database and if it matches the one defined in the settings.

πŸ‘€PrimozKocevar

Leave a comment