DrHakeshi
DrHakeshi

Reputation: 3

Django debug toolbar loads but doesn't show on the local server even after proper installation

I have installed django debug toolbar correctly on a pipenv environment and done the main steps, such as adding internal_ips of 127.0.0.1 and adding the debug toolbar to installed_apps and middleware but still whenever I run the server and open a template of an app the debug toolbar doesn't show. However if I open the page source in the browser, it shows all the list elements of the toolbar however the toolbar doesn't display, does anyone know what is going wrong and how I could fix it.

This are the changes made to the settings.py file:

import mimetypes
mimetypes.add_type("application/javascript", ".js", True)
mimetypes.add_type("text/css", ".css", True)
mimetypes.add_type("text/html", ".html", True)
INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'playground',
    'debug_toolbar',
]

MIDDLEWARE = [
    'debug_toolbar.middleware.DebugToolbarMiddleware',
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    ]

INTERNAL_IPS = [
    '127.0.0.1',
]

And the following changes to the urls.py folder:

import debug_toolbar

urlpatterns = [
    ...,
    path('__debug__/', include(debug_toolbar.urls))
]

Upvotes: 0

Views: 494

Answers (1)

KaliLinux
KaliLinux

Reputation: 1

Use that debug_toolbar.apps.DebugToolbarConfig in INSTALLED_APPS instead of debug-toolbar. Like this:

INSTALLED_APPS = [
     ...
   'debug_toolbar.apps.DebugToolbarConfig',  ...
]

Upvotes: 0

Related Questions