我遵循django站点上的站点地图激活步骤,但我一直在收到'TemplateDoesNotExist'错误。也许我误解了,但不是泛型视图应该生成页面?'TemplateDoesNotExist'为Django应用程序创建站点地图的错误
########### url.py #############################3
.........
from django.contrib.sitemaps import FlatPageSitemap, GenericSitemap
........
........
info_dict = {
'queryset': Bookmark.objects.all(),
'date_field': 'added'
}
sitemaps = {
'bookmarks': GenericSitemap(info_dict, changefreq = 'never', priority=0.6),
}
urlpatterns = patterns('',
.............
url(r'^$', 'microblogging.views.public', name="home"),
(r'^sitemap.xml$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': sitemaps}),
.............
)
if settings.SERVE_MEDIA:
urlpatterns += patterns('',
(r'^site_media/(?P<path>.*)$', 'misc.views.serve')
)
############# error #############################
TemplateDoesNotExist at /sitemap.xml
sitemap.xml
Request Method: GET
Request URL: http://localhost:8000/sitemap.xml
Exception Type: TemplateDoesNotExist
Exception Value:
sitemap.xml
Exception Location: /usr/lib/python2.5/site-packages/django/template/loader.py in find_template_source, line 73
Python Executable: /usr/bin/python2.5
Python Version: 2.5.4
是的,他们都在我的设置文件。 – 2009-10-18 23:17:45
啊!因为我为dev/production设置了settings.py/local_settings.py,我忘了将它添加到local_settings.py – 2009-10-19 02:21:39