Your repo is currently private. That will need to be made public if you want us to review the code. Otherwise, you can let us know what you’ve tried. Share your installed apps, middleware, toolbar settings, and whether the toolbar is being injected into the HTML, but not shown or if it’s not being injected at all. Other questions: are you using docker, are you using channels, did the toolbar show up when you browse to the admin?
Trying all different options I could think of for
INTERNAL_IPS = [127.0.0.1]
INTERNAL_IPS = [‘127.0.0.1’]
INTERNAL_IPS = [127.0.0.1,]
INTERNAL_IPS = [‘127.0.0.1’,]
Moving “debug_toolbar.middleware.DebugToolbarMiddleware”, up and down in the MIDDLEWARE.
Change debug = True instead of DEBUG = env.bool(“DJANGO_DEBUG”)
I made sure it is in installed apps.
This is my allowed hosts setting: ALLOWED_HOSTS = [".herokuapp.com", “localhost”, “127.0.0.1”]
Not sure if that makes a difference.
If you’re using “localhost” as the address in your browser address bar, you might want to add it to INTERNAL_IPS.
Also, you’re showing an external name in ALLOWED_HOSTS - are you running this in heroku? If so, you need to add your public-facing IP address to INTERNAL_IPS - and, depending upon your ISP and heroku, it might be an IPv6 address as well. (The INTERNAL_IPS list is checking for the REMOTE_ADDR header in the request - it’s verifying that the browser making the request is in that list. Check your server log to see what is showing as the IP address making the requests.)
Just to recap. I am really wondering why it does not work as I am following Will’s book Django for Professionals, but I am skipping the Docker and testing part (this time round). Maybe this will affect it.
And again - this is asking for what you are entering in your address bar in your browser to go to your site.
When testing your site, do you use:
http://127.0.0.1/
http://localhost/
http://something-else/ (non-local address)
What you want to look at is your server logs - specifically, what is being received as the REMOTE_ADDR header in the http request. The easiest thing to do to identify this is to throw a print statement to print that header in a view and see what you’re getting.
Whatever you’re getting is what needs to be in your INTERNAL_IPS list.
Then yes, your INTERNAL_IPS should include an entry for ‘127.0.0.1’. (It’s a string, not a number, so must be enclosed in quotes.)
I saw where you said that you had tried this before, so I’m now willing to rule this out as the likely cause of the issue you’re facing, pending verification of the REMOTE_ADDR header. (And based on your logging comment, a print statement in a view may be the easiest way to verify it. You could also look at the network tab in your browser’s developer tools to see the request.)
Well, I hate to say it, but your project works for me exactly as posted in git - making three trivial changes. (Changed the database to match a test database I created for this, set DEBUG=True rather than an environment variable, and set INTERNAL_IPS = ['127.0.0.1']), and this is what I get:
I changed my database to original django sqlite code.
I changed internal_ip as you demonstrated above.
I move debug_toolbar middleware to the top of the list.
… Still not showing up.
I am giving up on this and move on in the book. I will give this an other try some time later.
Thank you all for helping.
Have you checked once in the Developer Console of your browser? In my case I had a MIME Type error on Windows. To be exact:
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.
To solve this, I had add the following lines of code to my project settings.py.
if DEBUG:
import mimetypes
mimetypes.add_type("application/javascript", ".js", True)