Django/Wagtail : django-debug-toolbar 在点击面板时出现 404 错误
Django/Wagtail : django-debug-toolbar gives 404 error when cicking on panel
工具栏显示漂亮干净,但是当我单击面板以查看它是否真的有效时,它会显示 404:未找到错误。
我检查了很多答案等等,但它们来自非常旧的版本,恐怕我错过了一些重要的更新日志。
我的urls.py
import debug_toolbar
from django.conf import settings
from django.urls import include, path
from django.contrib import admin
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 = [
path('django-admin/', admin.site.urls),
path('admin/', include(wagtailadmin_urls)),
path('documents/', include(wagtaildocs_urls)),
path('search/', search_views.search, name='search'),
]
urlpatterns = urlpatterns + [
path("", include(wagtail_urls)),
path('__debug__/', include(debug_toolbar.urls)),
]
if settings.DEBUG:
from django.conf.urls.static import static
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
urlpatterns += staticfiles_urlpatterns()
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
和我的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 = 'hidden'
# SECURITY WARNING: define the correct hosts in production!
ALLOWED_HOSTS = ['*']
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
INSTALLED_APPS = INSTALLED_APPS + [
'debug_toolbar'
]
MIDDLEWARE = MIDDLEWARE + [
'debug_toolbar.middleware.DebugToolbarMiddleware',
]
INTERNAL_IPS = ("127.0.0.1")
try:
from .local import *
except ImportError:
pass
我正在关注这个视频教程https://youtu.be/jxUeJsR_XSs?list=PLMQHMcNi6ocsS8Bfnuy_IDgJ4bHRRrvub
编辑:我通过放置
修复了它
path('__debug__/', include(debug_toolbar.urls)),
在我的 urlpatterns 函数中 urls.py
编辑:我通过放置
修复了它
path('__debug__/', include(debug_toolbar.urls)),
在我的 urlpatterns 函数中 urls.py
工具栏显示漂亮干净,但是当我单击面板以查看它是否真的有效时,它会显示 404:未找到错误。 我检查了很多答案等等,但它们来自非常旧的版本,恐怕我错过了一些重要的更新日志。
我的urls.py
import debug_toolbar
from django.conf import settings
from django.urls import include, path
from django.contrib import admin
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 = [
path('django-admin/', admin.site.urls),
path('admin/', include(wagtailadmin_urls)),
path('documents/', include(wagtaildocs_urls)),
path('search/', search_views.search, name='search'),
]
urlpatterns = urlpatterns + [
path("", include(wagtail_urls)),
path('__debug__/', include(debug_toolbar.urls)),
]
if settings.DEBUG:
from django.conf.urls.static import static
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
urlpatterns += staticfiles_urlpatterns()
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
和我的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 = 'hidden'
# SECURITY WARNING: define the correct hosts in production!
ALLOWED_HOSTS = ['*']
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
INSTALLED_APPS = INSTALLED_APPS + [
'debug_toolbar'
]
MIDDLEWARE = MIDDLEWARE + [
'debug_toolbar.middleware.DebugToolbarMiddleware',
]
INTERNAL_IPS = ("127.0.0.1")
try:
from .local import *
except ImportError:
pass
我正在关注这个视频教程https://youtu.be/jxUeJsR_XSs?list=PLMQHMcNi6ocsS8Bfnuy_IDgJ4bHRRrvub
编辑:我通过放置
修复了它path('__debug__/', include(debug_toolbar.urls)),
在我的 urlpatterns 函数中 urls.py
编辑:我通过放置
修复了它path('__debug__/', include(debug_toolbar.urls)),
在我的 urlpatterns 函数中 urls.py