3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Wagtailチュートリアル 5 Django Debug Toolbarをインストールしよう

Last updated at Posted at 2019-08-26

#Wagtailチュートリアル 4
<=4 バナーを追加しよう (2)
=>[6 Bootstrap4 を追加しよう]
(https://qiita.com/tagawahirotaka/items/519d7c3c51427b1bd3e7)

Django Debug Toolbarをインストールしよう

pip install django-debug-toolbar
django debug toolbarをインストール

14

wagtailtutorial/settings/dev.py

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
wagtailtutorial/urls.py

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

14
スクリーンショット 2019-08-26 10.16.51.png

3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?