mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-12 17:23:15 +00:00
Sitemap timeout can now be configured with a setting
This commit is contained in:
parent
f4245815ba
commit
8e1b2cf019
1 changed files with 2 additions and 1 deletions
|
|
@ -1,6 +1,7 @@
|
|||
from django.shortcuts import render
|
||||
from django.http import HttpResponse
|
||||
from django.core.cache import cache
|
||||
from django.conf import settings
|
||||
|
||||
from .sitemap_generator import Sitemap
|
||||
|
||||
|
|
@ -14,7 +15,7 @@ def sitemap(request):
|
|||
sitemap = Sitemap(request.site)
|
||||
sitemap_xml = sitemap.render()
|
||||
|
||||
cache.set(cache_key, sitemap_xml, 6000)
|
||||
cache.set(cache_key, sitemap_xml, getattr(settings, 'WAGTAILSITEMAPS_CACHE_TIMEOUT', 6000))
|
||||
|
||||
# Build response
|
||||
response = HttpResponse(sitemap_xml)
|
||||
|
|
|
|||
Loading…
Reference in a new issue