xxxxxxxxxx
INSTALLED_APPS = [
# ...
"debug_toolbar",
# ...
]
xxxxxxxxxx
python -m pip install django-debug-toolbar
# if you use virtual env:
# activate virtual env:
pipenv shell
# install mentioned packages inside virtual env:
pipenv install django-debug-toolbar
# goto django settings.py, add "debug_toolbar"
INSTALLED_APPS = [
# ...
'debug_toolbar',
]
# goto django urls.py:
urlpatterns = [
# ...
path('__debug__/', include('debug_toolbar.urls')),
]
# goto django setting.py:
MIDDLEWARE = [
# ...
"debug_toolbar.middleware.DebugToolbarMiddleware",
# ...
]
# goto django setting.py, add entire part of below after MIDDLEWARE:
INTERNAL_IPS = [
# ...
"127.0.0.1",
# ...
]
#note: django_debug_toolbar will only work if you have proper html body inside view
xxxxxxxxxx
$ python -m pip install django-debug-toolbar
xxxxxxxxxx
MIDDLEWARE = [
# ...
"debug_toolbar.middleware.DebugToolbarMiddleware",
# ...
]
xxxxxxxxxx
INTERNAL_IPS = [
# ...
"127.0.0.1",
# ...
]
django debug toolbar with docker
xxxxxxxxxx
def show_toolbar(request):
return True
DEBUG_TOOLBAR_CONFIG = {
'SHOW_TOOLBAR_CALLBACK': show_toolbar,
}
# or
INTERNAL_IPS = ['127.0.0.1']
import socket
# tricks to have debug toolbar when developing with docker
ip = socket.gethostbyname(socket.gethostname())
INTERNAL_IPS += [ip[:-1] + '1']
xxxxxxxxxx
$ python -m pip install django-debug-toolbar
xxxxxxxxxx
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
# Uncomment the next line for simple clickjacking protection:
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
xxxxxxxxxx
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
# Uncomment the next line for simple clickjacking protection:
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
xxxxxxxxxx
$ python -m pip install -e git+https://github.com/jazzband/django-debug-toolbar.git#egg=django-debug-toolbar