django-debug-toolbar

django-debug-toolbar ๋ฅผ ์ด์šฉํ•˜์—ฌ ์›น ํ”„๋กœ์ ํŠธ๋ฅผ ๋””๋ฒ„๊น…ํ•  ์ˆ˜ ์žˆ๋‹ค. ์ด ํˆด์„ ์‚ฌ์šฉํ•˜๋ฉด, ์›น ๋ธŒ๋ผ์šฐ์ €์—์„œ ํ•ด๋‹น ์›น ํŽ˜์ด์ง€์— ์‚ฌ์šฉ๋œ HTTP ํ—ค๋”, settings, SQL ๋ฌธ๋“ค, ํ…œํ”Œ๋ฆฟ ๊ณ„์ธต ๊ตฌ์กฐ ๋“ฑ ๋งค์šฐ ๋‹ค์–‘ํ•œ ๋””๋ฒ„๊น… ์ •๋ณด๋ฅผ ์‰ฝ๊ฒŒ ํŒŒ์•…ํ•  ์ˆ˜ ์žˆ๋‹ค.

์„ค์น˜

$ 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 ํŒจํ‚ค์ง€๋ฅผ ์„ค์น˜ํ•œ๋‹ค.

settings.py

์„ค์น˜๊ฐ€ ์™„๋ฃŒ๋˜์—ˆ์œผ๋ฉด ์žฅ๊ณ  ํ”„๋กœ์ ํŠธ settings.py ๋ฅผ ์„ค์ •ํ•ด์ค€๋‹ค.

INSTALLED_APPS = [
      ...,
   'debug_toolbar',
]

MIDDLEWARE = [
    # ...
    'debug_toolbar.middleware.DebugToolbarMiddleware',
    # ...
]

# ๋””๋ฒ„๊ทธ ๋ชจ๋“œ๋ฅผ ํ™•์ธํ•  IP์„ค์ •
INTERNAL_IPS = ('127.0.0.1',)

Urls.py

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

Last updated