Remove the Django Debug Toolbar entirely

Given that I rarely use this in practice, the potential advantages do not
weigh up aginst the actual disadvantages (breakage today, as well as in March,
see 38d49f5000)

Fix #168
This commit is contained in:
Klaas van Schelven
2025-07-25 20:30:03 +02:00
parent db94c00a94
commit 33fafc473b
3 changed files with 1 additions and 38 deletions

View File

@@ -1,5 +1,5 @@
from .default import * # noqa
from .default import BASE_DIR, INSTALLED_APPS, MIDDLEWARE, LOGGING, DATABASES, I_AM_RUNNING
from .default import BASE_DIR, LOGGING, DATABASES, I_AM_RUNNING
import os
@@ -12,34 +12,6 @@ SECRET_KEY = 'django-insecure-$@clhhieazwnxnha-_zah&(bieq%yux7#^07&xsvhn58t)8@xw
DEBUG = True
# > The Debug Toolbar is shown only if your IP address is listed in Djangos INTERNAL_IPS setting. This means that for
# > local development, you must add "127.0.0.1" to INTERNAL_IPS.
INTERNAL_IPS = [
"127.0.0.1",
]
if not I_AM_RUNNING == "TEST":
INSTALLED_APPS += [
"debug_toolbar",
]
MIDDLEWARE = [
"debug_toolbar.middleware.DebugToolbarMiddleware",
] + MIDDLEWARE
def show_toolbar_for_queryparam(request):
# avoid "django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet."
from debug_toolbar.middleware import show_toolbar
if "__debug__" not in request.path and not request.GET.get("debug", ""):
return False
return show_toolbar(request)
DEBUG_TOOLBAR_CONFIG = {
"SHOW_TOOLBAR_CALLBACK": show_toolbar_for_queryparam,
}
# this way of configuring (DB, DB_USER, DB_PASSWORD) is specific to the development environment
if os.getenv("DB", "sqlite") == "mysql":
DATABASES['default'] = {

View File

@@ -89,14 +89,6 @@ if settings.DEBUG:
path('trigger-error/', trigger_error),
]
try:
import debug_toolbar # noqa
urlpatterns = [
path('__debug__/', include('debug_toolbar.urls')),
] + urlpatterns
except ImportError:
pass
handler400 = "bugsink.views.bad_request"
handler403 = "bugsink.views.permission_denied"

View File

@@ -1,3 +1,2 @@
# testing/development only:
django-debug-toolbar==5.2.*
coverage