[PYTHON] django-debug-toolbar installation procedure memo

Preface

This is a memo for beginners. Even if you do it as you googled in your environment It didn't move, so it's a memo when I managed to move.

django 1.11

document https://django-debug-toolbar.readthedocs.io/en/stable/

Install with pip

$ pip install django-debug-toolbar

Write settings in settings.py

I copied it from the link below. .. .. http://stackoverflow.com/questions/6390310/how-do-i-see-the-django-debug-toolbar

settings.py


if DEBUG:
    INTERNAL_IPS = ('127.0.0.1',)
    MIDDLEWARE += (
        'debug_toolbar.middleware.DebugToolbarMiddleware',
    )

    INSTALLED_APPS += (
        'debug_toolbar',
    )
    #Contents to be displayed
    DEBUG_TOOLBAR_PANELS = [
        'debug_toolbar.panels.versions.VersionsPanel',
        'debug_toolbar.panels.timer.TimerPanel',
        'debug_toolbar.panels.settings.SettingsPanel',
        'debug_toolbar.panels.headers.HeadersPanel',
        'debug_toolbar.panels.request.RequestPanel',
        'debug_toolbar.panels.sql.SQLPanel',
        'debug_toolbar.panels.staticfiles.StaticFilesPanel',
        'debug_toolbar.panels.templates.TemplatesPanel',
        'debug_toolbar.panels.cache.CachePanel',
        'debug_toolbar.panels.signals.SignalsPanel',
        'debug_toolbar.panels.logging.LoggingPanel',
        'debug_toolbar.panels.redirects.RedirectsPanel',
    ]

    DEBUG_TOOLBAR_CONFIG = {
        'INTERCEPT_REDIRECTS': False,
    }

Add to urls.py

Please rewrite your_app in a timely manner.

urls.py


from django.conf import settings
from django.conf.urls import url, include
from django.contrib import admin


urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^your_app/', include('your_app.urls')),
]

if settings.DEBUG:
    import debug_toolbar
    urlpatterns += (
        url(r'^your_app/', include(debug_toolbar.urls)),
    )

important point

By default, the body tag is searched and inserted immediately before. Therefore, it will not be displayed without the body tag.

Finally

Honestly, even if you look at debug-toolbar? I'm a beginner with many things, but I was happy that it worked. I often don't know the settings, so I want to study little by little.

Recommended Posts

django-debug-toolbar installation procedure memo
PostgreSQL 10.0 installation procedure
blockdiag installation procedure
Linux mint installation procedure
python openCV installation (memo)
AWS CLI installation procedure
ubuntu20.04 + Geth installation procedure
Anaconda3 environment installation procedure
Scrapy environment installation procedure
Offline installation procedure for openpyxl
Python CMS Mezzanine installation procedure
CentOS 8 installation procedure (latest version)
Docker Easy Installation Procedure (CentOS)
Python 3.6 installation procedure [for Windows]
ubuntu 20.04 + VirtalBox installation procedure summary
[Python] virtualenv creation procedure memo
Python memo Anaconda installation (Mac only)
OpenCV installation procedure on Raspberry Pi
PySpark 1.5.2 + Elasticsearch 2.1.0 Installation procedure and execution
Teamviewer for Linux installation procedure (CentOS)
Summary of Oracle Database XE installation procedure
WSL2 (Windows Subsystem for Linux) installation procedure
BESS Development Memo # 01: BESS Installation and Basic Usage