From cc2bc24ee83b2ed9fcf2a0c56143acddafb83b3b Mon Sep 17 00:00:00 2001 From: Brylie Christopher Oxley Date: Tue, 9 Jan 2024 20:12:01 +0200 Subject: [PATCH] Configure Django debug toolbar --- core/settings.py | 11 +++++++++++ core/urls.py | 12 +++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/core/settings.py b/core/settings.py index 14d37ab..282fcb7 100644 --- a/core/settings.py +++ b/core/settings.py @@ -35,6 +35,10 @@ default=True, ) +INTERNAL_IPS = [ + "127.0.0.1", +] + ALLOWED_HOSTS = env.list( "DJANGO_ALLOWED_HOSTS", default=[ @@ -56,6 +60,7 @@ "django.contrib.staticfiles", "crispy_forms", "crispy_bootstrap5", + "debug_toolbar", "accounts", "activities", "caregivers", @@ -71,6 +76,12 @@ CRISPY_TEMPLATE_PACK = "bootstrap5" MIDDLEWARE = [ + # The order of MIDDLEWARE is important. + # Include the Debug Toolbar middleware as early as possible in the list. + # However, it must come after any other middleware that encodes + # the response’s content, such as GZipMiddleware. + # https://django-debug-toolbar.readthedocs.io/en/latest/installation.html#add-the-middleware + "debug_toolbar.middleware.DebugToolbarMiddleware", "django.middleware.security.SecurityMiddleware", "whitenoise.middleware.WhiteNoiseMiddleware", "django.contrib.sessions.middleware.SessionMiddleware", diff --git a/core/urls.py b/core/urls.py index 7324fd3..5bb6e44 100644 --- a/core/urls.py +++ b/core/urls.py @@ -18,6 +18,10 @@ from django.views.generic.base import TemplateView urlpatterns = [ + path( + "__debug__/", + include("debug_toolbar.urls"), + ), path("admin/", admin.site.urls), path( "i18n/", @@ -47,5 +51,11 @@ "work/", include("work.urls"), ), - path("", TemplateView.as_view(template_name="home.html"), name="home"), + path( + "", + TemplateView.as_view( + template_name="home.html", + ), + name="home", + ), ]