I followed the sitemap activation steps on the django site but i keep getting a 'TemplateDoesNotExist' error. Maybe i am misunderstanding, but isn't genericview supposed to generate the page?
########### 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
This is because it's not finding the default templates.
Make sure 'django.template.loaders.app_directories.load_template_source'
is in your TEMPLATE_LOADERS
setting, and also make sure that 'django.contrib.sitemaps'
is in your INSTALLED_APPS
.
deprecated, latest is: 'django.template.loaders.app_directories.Loader',
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With