Dockerize Django app with dev/beta/prod env config and uv #6
@@ -147,7 +147,7 @@ STATIC_URL = "static/"
|
||||
STATIC_ROOT = BASE_DIR / "staticfiles"
|
||||
STORAGES = {
|
||||
"staticfiles": {
|
||||
"BACKEND": "whitenoise.storage.CompressedManifestStaticFilesStorage",
|
||||
"BACKEND": "company_site.storage.TolerantManifestStaticFilesStorage",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
"""Custom static files storage.
|
||||
|
||||
WhiteNoise's manifest storage post-processes JS/CSS during ``collectstatic`` and
|
||||
strictly resolves every referenced file, including ``sourceMappingURL`` comments
|
||||
in vendored bundles. Some third-party assets reference ``.map`` files that are
|
||||
not shipped, which makes ``collectstatic`` fail hard.
|
||||
|
||||
``TolerantManifestStaticFilesStorage`` leaves such unresolved references
|
||||
untouched instead of raising, so a missing source map can't break the build.
|
||||
"""
|
||||
|
||||
from whitenoise.storage import CompressedManifestStaticFilesStorage
|
||||
|
||||
|
||||
class TolerantManifestStaticFilesStorage(CompressedManifestStaticFilesStorage):
|
||||
def _stored_name(self, name, hashed_files):
|
||||
try:
|
||||
return super()._stored_name(name, hashed_files)
|
||||
except ValueError:
|
||||
return name
|
||||
Reference in New Issue
Block a user