Home > Software engineering >  django debug toolbar uploaded badly
django debug toolbar uploaded badly

Time:09-29

just starting using Django (first project) and I wanted to install the Django Debug Toolbar. I did exactly as the installation guide in the documentation here said: enter image description here

The html file that is loaded is a simple but legit one and ill add it here:

<html>
<body>
    {% if name %}
    <h1>Hello {{name}}</h1>
    {% else %}
    <h1>Hello World</h1>
    {% endif %}
</body>

BTW: Removing the if statements is not working either, also not working on both chrome and firefox.

Thanks for the help :)

CodePudding user response:

I had the same problem. This worked for me.

if DEBUG:
    import mimetypes
    from django.urls import path, include

    mimetypes.add_type("application/javascript", ".js", True)
    INTERNAL_IPS = ('127.0.0.1',)
    INSTALLED_APPS  = ['debug_toolbar']
    MIDDLEWARE  = ['debug_toolbar.middleware.DebugToolbarMiddleware']

CodePudding user response:

Found an answer from @AlexElizard and mixed it with some other user answer from coding with mosh forum:

  1. In Windows, edit the registry HKEY_CLASSES_ROOT\.js\Content Type from text/plain to text/javascript using Registry Editor. (Doing this alone didn't help.)
  2. Clear cache of the browser.

And now it works just fine.

  • Related