3

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?

mohsen37
  • 101
  • 5

2 Answers2

7

this work for me!

in settings.py

import mimetypes

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

DEBUG_TOOLBAR_CONFIG = {
    "INTERCEPT_REDIRECTS": False,
}

mohsen37
  • 101
  • 5
  • Please add further details to expand on your answer, such as working code or documentation citations. – Community Sep 06 '21 at 12:43
  • I'm using Django 3.2.8 and django-debug-toolbar 3.2.2 and after following the instructions found here https://django-debug-toolbar.readthedocs.io/en/latest/installation.html exactly as they are written, it wasn't until I applied this code to my settings.py file that it finally started working. Thank you, this took me a while before I found your solution and it worked perfectly. – Mike Dinder Oct 10 '21 at 20:00
0

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

KyleStranger
  • 233
  • 3
  • 20