Created
December 13, 2016 12:25
-
-
Save Apkawa/05a590ea85ff64eee91d3b0b317e49a5 to your computer and use it in GitHub Desktop.
RevisionStaticFileStorage pass settings.STATIC_REV to url
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
from __future__ import unicode_literals | |
from django.conf import settings | |
from django.contrib.staticfiles.storage import StaticFilesStorage | |
class RevisionStaticFilesStorage(StaticFilesStorage): | |
def url(self, name): | |
version = getattr(settings, 'STATIC_REV', None) | |
url = super(RevisionStaticFilesStorage, self).url(name) | |
return "{}?r={}".format(url, version) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment