diff options
author | Dan McGee <dan@archlinux.org> | 2012-09-30 13:30:09 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2012-09-30 13:30:21 -0500 |
commit | 58ecb90c3f0254cdfab290234d309cad14a17723 (patch) | |
tree | 86a680c6142f16fa6d51b2b686139a45eef6c683 /urls.py | |
parent | 50daf33d080c9fa85bf10e98b975cc44f6f72314 (diff) |
Add caching of sitemaps
Upstream Django bug #2713 was fixed in
https://github.com/django/django/commit/123f567093, so we can now enable
caching of sitemaps.
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'urls.py')
-rw-r--r-- | urls.py | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -1,5 +1,6 @@ from django.conf.urls import include, patterns, url from django.contrib import admin +from django.contrib.sitemaps import views as sitemap_views from django.views.decorators.cache import cache_page from django.views.generic import TemplateView, RedirectView @@ -34,13 +35,13 @@ feeds_patterns = patterns('', ) # Sitemaps -urlpatterns += patterns('django.contrib.sitemaps.views', - # Thanks Django, we can't cache these longer because of - # https://code.djangoproject.com/ticket/2713 - (r'^sitemap.xml$', 'index', - {'sitemaps': our_sitemaps}), - (r'^sitemap-(?P<section>.+)\.xml$', 'sitemap', - {'sitemaps': our_sitemaps}), +urlpatterns += patterns('', + (r'^sitemap.xml$', + cache_page(1800)(sitemap_views.index), + {'sitemaps': our_sitemaps, 'sitemap_url_name': 'sitemaps'}), + (r'^sitemap-(?P<section>.+)\.xml$', + cache_page(1800)(sitemap_views.sitemap), + {'sitemaps': our_sitemaps}, 'sitemaps'), ) # Authentication / Admin |