Enable cache-busting URLs for CSS and JS

This will allow us to increase the cache times in the browser for our
CSS, which almost never changes.

Enables a new value to be used in templates, {{gitrev}}, which can be
used to bust pretty much any URL. We could do this for all the images
in the templates as well, but since most of them almost never change,
we'll just enable it manually for each individual image as it becomes
necessray - or just use a ?1, ?2 etc for those.

Enabled by default for CSS and JavaScript links, since those are much
more likely to be changed without having the URL changed.

Cache times aren't increased yet - we'll do that later one we're sure
that all existing caches are expired first.
This commit is contained in:
Magnus Hagander
2014-01-01 15:24:51 +01:00
parent 34bd7b54a5
commit 48410d04fa
7 changed files with 37 additions and 22 deletions

View File

@ -1,6 +1,7 @@
from django.shortcuts import render_to_response, get_object_or_404
from django.http import HttpResponse, Http404, HttpResponseRedirect
from django.template import TemplateDoesNotExist, loader, Context
from django.template.context import RequestContext
from django.contrib.auth.decorators import login_required
from django.db.models import Q
from django.conf import settings
@ -67,7 +68,7 @@ def docpage(request, version, typ, filename):
'can_comment': (typ=="interactive" and ver==currver),
'doc_index_filename': indexname,
'loaddate': loaddate,
})
}, RequestContext(request))
def docsrootpage(request, version, typ):
return docpage(request, version, typ, 'index')