From fff7a08aee2a3d4f25bad7da0a5cbc39d57ef34a Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Sat, 20 Mar 2021 11:23:33 +0100 Subject: [PATCH] Enable debug toolbar --- blog/settings.py | 6 ++++++ blog/urls.py | 2 ++ 2 files changed, 8 insertions(+) diff --git a/blog/settings.py b/blog/settings.py index 7091723..271275b 100644 --- a/blog/settings.py +++ b/blog/settings.py @@ -71,10 +71,12 @@ INSTALLED_APPS = [ "anymail", "django_cleanup.apps.CleanupConfig", "compressor", + "debug_toolbar", ] MIDDLEWARE = [ "django.middleware.security.SecurityMiddleware", + "debug_toolbar.middleware.DebugToolbarMiddleware", "django.contrib.sessions.middleware.SessionMiddleware", "django.middleware.common.CommonMiddleware", "django.middleware.csrf.CsrfViewMiddleware", @@ -142,6 +144,10 @@ DATABASES = { } } +INTERNAL_IPS = [ + "127.0.0.1", + "localhost", +] # Password validation # https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators diff --git a/blog/urls.py b/blog/urls.py index 9cf1ede..0e71792 100644 --- a/blog/urls.py +++ b/blog/urls.py @@ -13,6 +13,7 @@ Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ +import debug_toolbar from django.conf.urls.static import static from django.contrib import admin from django.urls import include, path @@ -33,3 +34,4 @@ urlpatterns = [ if settings.DEBUG: urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) + urlpatterns += [path("__debug__/", include(debug_toolbar.urls))]