I too feel the need to occasionally inspect the production environment in details, and use a few simple strategies:
(1) As you probably know, you can add an ADMINS list to the project's settings, to receive via email a copy of the "yellow debug screen" which is normally shown in development; see:
https://docs.djangoproject.com/en/3.1/ref/settings/#admins
(2) For greater inspection in production, I normally install django-debug-toolbar and configure it as follows:
def show_toolbar(request):
from constance import config
try:
if not config.DEBUG_SHOW_TOOLBAR:
return False
except:
return False
return request.user.is_superuser
DEBUG_TOOLBAR_PATCH_SETTINGS = False
INTERNAL_IPS = ('127.0.0.1', )
DEBUG_TOOLBAR_CONFIG = {
'SHOW_TOOLBAR_CALLBACK': 'main.settings.settings.show_toolbar',
}
DEBUG_TOOLBAR_PANELS = [
'debug_toolbar.panels.versions.VersionsPanel',
...
The toolbar is normally hidden, unless I enable a DEBUG_SHOW_TOOLBAR flag (I'm using django-constance for dynamic settings); with DEBUG_SHOW_TOOLBAR set to True, the debug panels are shown to the supervisors.
(3) Finally, I always include this snippet in my projects:
file 'main/settings/debug.py'
from main.settings.local import *
DEBUG = True
ALLOWED_HOSTS = ['*', ]
(being "main/setting/local.py" my default setting)
so as a last resort I can quickly and temporary run a debug instance of the project via SSH as follows:
python manage.py runserver --settings=main.settings.debug 0.0.0.0:8000
then visit the site in DEBUG mode on port 8000