我在浏览器中输入以下网址:
http://localhost:8000/en/weblog/2010/aug/10/wie-baue-ich-ein-weblog/
我收到“找不到页面 (404)”错误,尽管第 10 个条目
(r'^weblog/(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/(P?<slug>[-\w]+)/$', 'django.views.generic.date_based.object_detail', entry_info_dict),
在我的 URLConf 中应该匹配。
唯一的区别是语言的前缀,但这不会影响其他模式,所以它为什么只影响这个。(所有的urlpatterns都匹配,除了上面那个)
我的 UrlConf 看起来像这样:
网址.py
from django.conf.urls.defaults import *
from webpage import settings
import os
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
from blog.models import Entry
urlpatterns = patterns('preview.views',
(r'^admin/(.*)', admin.site.root),
(r'^$', 'home'),
(r'^about_me.html/', 'show_about_me'),
(r'^study.html/', 'show_study'),
(r'^profile.html/', 'show_profile'),
(r'^blog.html/', 'show_blog'),
(r'^contact.html/', 'show_contact'),
(r'^impressum.html/', 'show_impressum'),
)
entry_info_dict = {
'queryset': Entry.objects.all(),
'date_field': 'pub_date',
}
urlpatterns += patterns('',
(r'^weblog/$', 'webpage.blog.views.entries_index'),
(r'^weblog/(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/(P?<slug>[-\w]+)/$', 'django.views.generic.date_based.object_detail', entry_info_dict),
)
if settings.DEBUG:
urlpatterns += patterns('',
(r'^static/(?P<path>.*)$', 'django.views.static.serve', { 'document_root' : os.path.join(settings.CURRENT_PATH, 'static') }),
)
问题是什么。我很感激任何帮助,
此致。