Skip to content

Commit

Permalink
add custom ManifestStaticFilesStorageNotStrict
Browse files Browse the repository at this point in the history
  • Loading branch information
Grace-Amondi committed Jun 12, 2023
1 parent 25d170e commit 957c539
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
9 changes: 9 additions & 0 deletions core/storage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from django.contrib.staticfiles.storage import ManifestStaticFilesStorage

class ManifestStaticFilesStorageNotStrict(ManifestStaticFilesStorage):

def hashed_name(self, name, content=None, filename=None):
try:
return super().hashed_name(name, content=content, filename=filename)
except ValueError:
return name
5 changes: 1 addition & 4 deletions nmhs_cms/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,5 @@
}
}

# Simplified static file serving.
# https://warehouse.python.org/project/whitenoise/
STATICFILES_STORAGE = "core.storage.ManifestStaticFilesStorageNotStrict"

MIDDLEWARE.append("whitenoise.middleware.WhiteNoiseMiddleware")
STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"

0 comments on commit 957c539

Please sign in to comment.