Django-Debug-Toolbar not showing(disallowed MIME type)

Viewed 614

i install django-debug-toolbar 3.2.2 and configure it step by step by Installation Django Debug Toolbar

my templates is just hello.html

<html>
    <body>
        <h1>Hello {{ name }}</h1>
    </body>
</html>

at the end, when i type python manage.py runserver Django Debug Toolbar not show up. but in concole i see this

Loading module from “http://127.0.0.1:8000/static/debug_toolbar/js/toolbar.js” was blocked because of a disallowed MIME type (“text/plain”).

  • python 3.8.8(base on anaconda)
  • Django 3.2.7
  • windows 10

what's going on?

2 Answers

this work for me!

in settings.py

import mimetypes

mimetypes.add_type("application/javascript", ".js", True)

DEBUG_TOOLBAR_CONFIG = {
    "INTERCEPT_REDIRECTS": False,
}

Try including static files in urls.py:

from django.conf import settings
    from django.conf.urls.static import static
    
    urlpatterns = [
        # ... the rest of your URLconf goes here ...
    ] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

OR

Try changing the version of django-debug-toolbar. I had the same problem on django-debug-toolbar-3.1.1 and just switched to 2.2 and it worked

Related