django-debug-toolbar not showing up

前端 未结 27 1678
谎友^
谎友^ 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条回答
  •  猫巷女王i
    2020-11-30 21:17

    An addition to previous answers:

    if the toolbar doesn't show up, but it loads in the html (check your site html in a browser, scroll down)

    the issue can be that debug toolbar static files are not found (you can also see this in your site's access logs then, e.g. 404 errors for /static/debug_toolbar/js/toolbar.js)

    It can be fixed the following way then (examples for nginx and apache):

    nginx config:

    location ~* ^/static/debug_toolbar/.+.(ico|css|js)$ {
        root [path to your python site-packages here]/site-packages/debug_toolbar;
    }
    

    apache config:

    Alias /static/debug_toolbar [path to your python site-packages here]/site-packages/debug_toolbar/static/debug_toolbar
    

    Or:

    manage.py collectstatic
    

    more on collectstatic here: https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#collectstatic

    Or manualy move debug_toolbar folder of debug_toolbar static files to your set static files folder

提交回复
热议问题