mirror of
https://github.com/jointakahe/takahe.git
synced 2024-11-14 03:11:46 +00:00
Totally unload debug toolbar outside of debug
This commit is contained in:
parent
df90285356
commit
3e2ae1b209
2 changed files with 7 additions and 4 deletions
|
@ -176,7 +176,6 @@ INSTALLED_APPS = [
|
|||
"django.contrib.messages",
|
||||
"django.contrib.staticfiles",
|
||||
"corsheaders",
|
||||
"debug_toolbar",
|
||||
"django_htmx",
|
||||
"core",
|
||||
"activities",
|
||||
|
@ -195,7 +194,6 @@ MIDDLEWARE = [
|
|||
"django.middleware.common.CommonMiddleware",
|
||||
"django.middleware.csrf.CsrfViewMiddleware",
|
||||
"django.contrib.auth.middleware.AuthenticationMiddleware",
|
||||
"debug_toolbar.middleware.DebugToolbarMiddleware",
|
||||
"django.contrib.messages.middleware.MessageMiddleware",
|
||||
"django.middleware.clickjacking.XFrameOptionsMiddleware",
|
||||
"django_htmx.middleware.HtmxMiddleware",
|
||||
|
@ -311,8 +309,11 @@ MEDIA_URL = SETUP.MEDIA_URL
|
|||
MEDIA_ROOT = SETUP.MEDIA_ROOT
|
||||
MAIN_DOMAIN = SETUP.MAIN_DOMAIN
|
||||
|
||||
# Debug toolbar should only be loaded at all when debug is on
|
||||
if DEBUG:
|
||||
INSTALLED_APPS.append("debug_toolbar")
|
||||
DEBUG_TOOLBAR_CONFIG = {"SHOW_TOOLBAR_CALLBACK": "core.middleware.show_toolbar"}
|
||||
MIDDLEWARE.insert(8, "debug_toolbar.middleware.DebugToolbarMiddleware")
|
||||
|
||||
if SETUP.USE_PROXY_HEADERS:
|
||||
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
|
||||
|
|
|
@ -248,8 +248,6 @@ urlpatterns = [
|
|||
path(".stator/", stator.RequestRunner.as_view()),
|
||||
# Django admin
|
||||
path("djadmin/", djadmin.site.urls),
|
||||
# Debug toolbar
|
||||
path("__debug__/", include("debug_toolbar.urls")),
|
||||
# Media files
|
||||
re_path(
|
||||
r"^media/(?P<path>.*)$",
|
||||
|
@ -257,3 +255,7 @@ urlpatterns = [
|
|||
kwargs={"document_root": djsettings.MEDIA_ROOT},
|
||||
),
|
||||
]
|
||||
|
||||
# Debug toolbar
|
||||
if djsettings.DEBUG:
|
||||
urlpatterns.append(path("__debug__/", include("debug_toolbar.urls")))
|
||||
|
|
Loading…
Reference in a new issue