summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2012-09-30 13:30:09 -0500
committerDan McGee <dan@archlinux.org>2012-09-30 13:30:21 -0500
commit58ecb90c3f0254cdfab290234d309cad14a17723 (patch)
tree86a680c6142f16fa6d51b2b686139a45eef6c683
parent50daf33d080c9fa85bf10e98b975cc44f6f72314 (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>
-rw-r--r--urls.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/urls.py b/urls.py
index 6cbee5dc..f01aeecb 100644
--- a/urls.py
+++ b/urls.py
@@ -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