django-debug-toolbar not showing up

前端 未结 27 1639
谎友^
谎友^ 2020-11-30 20:12

I looked at other questions and can\'t figure it out...

I did the following to install django-debug-toolbar:

  1. pip install django-debug-toolbar
27条回答
  •  既然无缘
    2020-11-30 21:12

    Debug toolbar wants the ip address in request.META['REMOTE_ADDR'] to be set in the INTERNAL_IPS setting. Throw in a print statement in one of your views like such:

    print("IP Address for debug-toolbar: " + request.META['REMOTE_ADDR'])
    

    And then load that page. Make sure that IP is in your INTERNAL_IPS setting in settings.py.

    Normally I'd think you would be able to determine the address easily by looking at your computer's ip address, but in my case I'm running the server in a Virtual Box with port forwarding...and who knows what happened. Despite not seeing it anywhere in ifconfig on the VB or my own OS, the IP that showed up in the REMOTE_ADDR key was what did the trick of activating the toolbar.

提交回复
热议问题