mirror of
https://github.com/jlengrand/bugsink.git
synced 2026-03-10 08:01:17 +00:00
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:
@@ -1,5 +1,5 @@
|
|||||||
from .default import * # noqa
|
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
|
import os
|
||||||
|
|
||||||
@@ -12,34 +12,6 @@ SECRET_KEY = 'django-insecure-$@clhhieazwnxnha-_zah&(bieq%yux7#^07&xsvhn58t)8@xw
|
|||||||
DEBUG = True
|
DEBUG = True
|
||||||
|
|
||||||
|
|
||||||
# > The Debug Toolbar is shown only if your IP address is listed in Django’s 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
|
# this way of configuring (DB, DB_USER, DB_PASSWORD) is specific to the development environment
|
||||||
if os.getenv("DB", "sqlite") == "mysql":
|
if os.getenv("DB", "sqlite") == "mysql":
|
||||||
DATABASES['default'] = {
|
DATABASES['default'] = {
|
||||||
|
|||||||
@@ -89,14 +89,6 @@ if settings.DEBUG:
|
|||||||
path('trigger-error/', trigger_error),
|
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"
|
handler400 = "bugsink.views.bad_request"
|
||||||
handler403 = "bugsink.views.permission_denied"
|
handler403 = "bugsink.views.permission_denied"
|
||||||
|
|||||||
@@ -1,3 +1,2 @@
|
|||||||
# testing/development only:
|
# testing/development only:
|
||||||
django-debug-toolbar==5.2.*
|
|
||||||
coverage
|
coverage
|
||||||
|
|||||||
Reference in New Issue
Block a user