我按照django网站上的站点地图激活步骤,但我不断收到"TemplateDoesNotExist"错误.也许我是误解,但不是应该生成页面的genericview?
########### 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
Run Code Online (Sandbox Code Playgroud)
Mez*_*Mez 43
这是因为它没有找到默认模板.
确保'django.template.loaders.app_directories.load_template_source'
在您的TEMPLATE_LOADERS
设置中,并确保它在您的设置'django.contrib.sitemaps'
中INSTALLED_APPS
.
归档时间: |
|
查看次数: |
5474 次 |
最近记录: |