# 安装
pip install django-debug-toolbar
# settings文件 注册
INSTALLED_APPS = [
# ...
'debug_toolbar',
]
# url 配置
from django.conf import settings
from django.urls import include, path
if settings.DEBUG:
import debug_toolbar
urlpatterns = [
path('__debug__/', include(debug_toolbar.urls)),
] + urlpatterns
# 启用 middleware
MIDDLEWARE += ["debug_toolbar.middleware.DebugToolbarMiddleware"]
# 启用内部IP
INTERNAL_IPS = ["127.0.0.1"]