1

style.css: make hash the same

This commit is contained in:
2024-01-27 19:19:51 +02:00
parent c3ef78605d
commit cecd679da6
11 changed files with 53 additions and 26 deletions

17
app/lib/staticfiles.py Normal file
View 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()