像这样,我的settings.py:
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',
'breadcrumbs.middleware.BreadcrumbsMiddleware',
'breadcrumbs.middleware.FlatpageFallbackMiddleware',
)
INSTALLED_APPS = (
...
'django.contrib.flatpages',
...
'breadcrumbs',
)
和我的 urls.py:
from django.conf.urls import patterns, include, url
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
...
url(r'^services/(?P<url>.*)$', 'breadcrumbs.views.flatpage'),
...
)
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
if settings.DEBUG:
urlpatterns += patterns('django.contrib.staticfiles.views',
url(r'^static/(?P<path>.*)$', 'serve'),
)
所以,
如果我删除了我的中间件类,那么平面页面就不起作用了。但是,如果我删除我的服务 url,平面页面会再次工作。他不使用这个。我需要知道使系统正常工作的原因。
再次感谢!