Issue with Django Debug Toolbar

The debugging toolbar does not appear and the browser gives me the following message. Can someone help me?

Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of “text/plain”. Strict MIME type checking is enforced for module scripts per HTML spec.

Same issue, did you find a solution?

I found a solution for Windows using this answer on this StackOverflow page.

First, in Windows, edit the registry HKEY_CLASSES_ROOT\.js\Content Type from text/plain to text/javascript using Registry Editor.

Next, restart your Django server. If the issue persists, clear cache from your web browser and restart your Django server again.

Hope that helps!

1 Like

This work for me:

add in settings.py:

# this is the main reason for not showing up the toolbar
    import mimetypes
    mimetypes.add_type("application/javascript", ".js", True)

    DEBUG_TOOLBAR_CONFIG = {
        'INTERCEPT_REDIRECTS': False,
    }

source:

I uses windows. Clearing browser cash helped for same problem. Before that i added static files and try everything that find in interner.
Clearing cash helped.

1 Like

" in Windows, edit the registry HKEY_CLASSES_ROOT\.js\Content Type from text/plain to text/javascript using Registry Editor"

This works in my case. Thank you! After days trying a solution and django debug bar not showing. Everything else was ok, changed python version for the same at Mosh videos, did everything like the videos and django debug install, several times, and bar not showing. This simple registry change was the solution.

Django Debug Toolbar 2022 - YouTube check this video this helped me

Step by step guide: Adding Django Debug Toolbar: A Step-by-Step Guide | by Abdullah Sohail | Jun, 2023 | Medium