$ pip install django-debug-toolbar
$ pip list
Package Version
-------------------- -------
Django 2.1.7
django-debug-toolbar 2.0
pip 19.2.3
pytz 2019.2
setuptools 40.6.2
가상 환경에서 pip를 사용하여 djnago-debug-toolbar 패키지를 설치한다.
INSTALLED_APPS = [
...,
'debug_toolbar',
]
MIDDLEWARE = [
# ...
'debug_toolbar.middleware.DebugToolbarMiddleware',
# ...
]
# 디버그 모드를 확인할 IP설정
INTERNAL_IPS = ('127.0.0.1',)
from django.contrib import admin
from django.urls import path
from django.conf import settings
from django.conf.urls import include, url
urlpatterns = [
path('admin/', admin.site.urls),
]
if settings.DEBUG:
import debug_toolbar
urlpatterns = [
url(r'^__debug__/', include(debug_toolbar.urls)),
] + urlpatterns