There are many SO questions about the Django errormessage Site matching query does not exist.
:
- Site matching query does not exist
- Django - Site matching query does not exist
- Getting Site Matching Query Does Not Exist Error after creating django admin
- Django project /admin Site matching query does not exist
- Django admin DoesNotExist at /admin/
- Django CMS malfunction: Site matching query does not exist
- Admin login stopped functioning Django
In all these cases, the cause was correctly identified to be the absence of a row in the django_site
table with the id specified as SITE_ID
in settings.py
.
Well, I want to prevent this from happening in the future. Right now, I have given a select few administrators superuser access to the Django admin. They have the power to destroy all data, if they want, and they are responsible for it. I myself, however, am responsible for server availability and want to prevent any Server 500 errors. In the current situation, my staff superusers can delete objects from the django_site
thereby rendering the site inaccessible, which I find unacceptable.
How can I prevent admin superusers from rendering the complete website inaccessible?