Please enable JS

Blog

NoReverseMatch at /sitemap.xml

Published on June 1, 2017, 12:52 a.m.

Reverse for 'django.contrib.sitemaps.views.sitemap' with arguments '()' and keyword arguments '{'section': 'foo'}' not found. 0 pattern(s) tried: []


from django.contrib.sitemaps import views as sitemaps_views
from django.views.decorators.cache import cache_page

urlpatterns = [
    url(r'^sitemap\.xml$',
        cache_page(1000)(sitemaps_views.index),
        {'sitemaps': sitemaps, 'sitemap_url_name': 'sitemaps'}),
    url(r'^sitemap-(?P<section>.+)\.xml$',
        cache_page(1000)(sitemaps_views.sitemap),
        {'sitemaps': sitemaps}, name='sitemaps'),
]