我们来安装Django Debug Toolbar 作为Wagtail教程的第5步
Wagtail教程第4节
只需要提供一个选项,以下是对原文的中文翻译:
添加不超过4个横幅 (2)
添加Bootstrap4
让我们安装 Django 调试工具栏。
使用pip安装django-debug-toolbar插件。
十四
from .base import *
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '%27wgs#)k(5z%d=xo_#$5cmvxabvps)16(@g-i#0q8ehyodphp'
# SECURITY WARNING: define the correct hosts in production!
ALLOWED_HOSTS = ['*']
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
# 14 django-debug-toolbarを追加
INSTALLED_APPS = INSTALLED_APPS + [
'debug_toolbar',
]
MIDDLEWARE = MIDDLEWARE + [
'debug_toolbar.middleware.DebugToolbarMiddleware',
]
INTERNAL_IPS = ("127.0.0.1", "172.17.0.1")
try:
from .local import *
except ImportError:
pass
from django.conf import settings
from django.conf.urls import include, url
from django.contrib import admin
#django-debug-toolbarの設定の為にpathをインポート
from django.urls import path
from wagtail.admin import urls as wagtailadmin_urls
from wagtail.core import urls as wagtail_urls
from wagtail.documents import urls as wagtaildocs_urls
from search import views as search_views
urlpatterns = [
url(r'^django-admin/', admin.site.urls),
url(r'^admin/', include(wagtailadmin_urls)),
url(r'^documents/', include(wagtaildocs_urls)),
url(r'^search/$', search_views.search, name='search'),
url(r'', include(wagtail_urls)),
]
if settings.DEBUG:
from django.conf.urls.static import static
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
# Serve static and media files from development server
urlpatterns += staticfiles_urlpatterns()
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
# 14 django-debug-toolbarを追加
import debug_toolbar
urlpatterns = [
path('__debug__/', include(debug_toolbar.urls)),
] + urlpatterns