T
T
turdaxunov2020-12-26 14:27:43
Django
turdaxunov, 2020-12-26 14:27:43

Django debug toolbar not showing up?

Hello, please help. Django-debug-toolbar not showing up on site:
5fe71e89849f4739920171.jpeg

Code in:

urls.py:

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', include('news.urls')),
]

if settings.DEBUG:
    import debug_toolbar

    urlpatterns = [
                      path('__debug__/', include(debug_toolbar.urls)),
                  ] + urlpatterns
    urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)


settings.py:
DEBUG = True
INSTALLED_APPS = [
'django.contrib.staticfiles',
    'debug_toolbar',
]
MIDDLEWARE = [
    'debug_toolbar.middleware.DebugToolbarMiddleware',
]
STATIC_URL = '/static/'

INTERNAL_IPS = [
    '127.0.0.1',
]

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
turdaxunov, 2020-01-02
@turdaxunov

It turned out to fix in urls.py added "mimetypes.add_type("application/javascript", ".js", True)" - if someone knows what I fixed in this way, please respond.
Looks like this:
if settings.DEBUG:
import debug_toolbar
import mimetypes
mimetypes.add_type("application/javascript", ".js", True)
urlpatterns = [
path('__debug__/', include(debug_toolbar.urls)),
] + urlpatterns
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question