style.css: make hash the same
This commit is contained in:
@@ -114,10 +114,9 @@ STATICFILES_FINDERS = [
|
||||
"django.contrib.staticfiles.finders.AppDirectoriesFinder",
|
||||
]
|
||||
|
||||
_storage = 'django.contrib.staticfiles.storage'
|
||||
STORAGES = {
|
||||
"staticfiles": {
|
||||
"BACKEND": _storage + ".ManifestStaticFilesStorage",
|
||||
"BACKEND": 'lib.staticfiles.ManifestStaticFilesStorageSha256'
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
17
app/lib/staticfiles.py
Normal file
17
app/lib/staticfiles.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from hashlib import sha256
|
||||
|
||||
from django.contrib.staticfiles.storage import ManifestStaticFilesStorage
|
||||
|
||||
|
||||
class ManifestStaticFilesStorageSha256(ManifestStaticFilesStorage):
|
||||
def file_hash(self, name, content=None):
|
||||
"""
|
||||
Return a hash of the file with the given name and optional content.
|
||||
"""
|
||||
if content is None:
|
||||
return None
|
||||
hasher = sha256(usedforsecurity=False)
|
||||
for chunk in content.chunks():
|
||||
hasher.update(chunk)
|
||||
return hasher.hexdigest()
|
||||
|
||||
Reference in New Issue
Block a user