install
pip
1
$ pip install django-debug-toolbar
pipenv
1
2
$ pipenv shell
$ pipenv install django-debug-toolbar
Setting
settings.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
INSTALLED_APPS = [
# ...
'debug_toolbar',
]
# ...
STATIC_URL = '/static/'
# ...
MIDDLEWARE = [
# ...
'debug_toolbar.middleware.DebugToolbarMiddleware',
]
# ...
INTERNAL_IPS = [
'127.0.0.1',
]
urls.py
1
2
3
4
5
6
7
8
9
10
from django.conf import settings
from django.URLS import path, include
# ...
if settings.DEBUG:
import debug_toolbar
urlpatterns += [
path('__debug__/', include(debug_toolbar.urls))
]