0

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: Django Debug Toolbar Docs- Installation

For some reason the page loads like this: 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 :)

N.Av
  • 21
  • 1
  • 6

2 Answers2

0

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']
  • I did it and now all the toolbar is gone from HTML, but still doesn't show at all, when I inspect the page I can see it is attached to the HTML file but it looks like it's hidden. Any idea? – N.Av Sep 28 '21 at 12:22
0

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.

bad_coder
  • 11,289
  • 20
  • 44
  • 72
N.Av
  • 21
  • 1
  • 6