mohsen37
mohsen37

Reputation: 161

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

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”).

what's going on?

Upvotes: 5

Views: 1616

Answers (2)

mohsen37
mohsen37

Reputation: 161

this work for me!

in settings.py

import mimetypes

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

DEBUG_TOOLBAR_CONFIG = {
    "INTERCEPT_REDIRECTS": False,
}

Upvotes: 11

KyleStranger
KyleStranger

Reputation: 231

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

Upvotes: 0

Related Questions