From 0242963415da53d16f31461e44f00726460ea384 Mon Sep 17 00:00:00 2001 From: Camilo Nova Date: Mon, 14 Jun 2021 12:02:56 -0500 Subject: [PATCH] Added STATICFILES_STORAGE to fix ValueError raised when a file is not at the manifest file --- README.md | 7 +++++++ manifest_loader/storage.py | 8 ++++++++ 2 files changed, 15 insertions(+) create mode 100644 manifest_loader/storage.py diff --git a/README.md b/README.md index 0ac9b1d..dde6c68 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,13 @@ cache-busting, split chunks. ## Quick reference: +Add `manifest_loader` to your `INSTALLED_APPS` and: + +``` +STATICFILES_STORAGE = 'manifest_loader.storage.DjangoManifestLoaderStorage' +``` + + ### Manifest tag ```djangotemplate diff --git a/manifest_loader/storage.py b/manifest_loader/storage.py new file mode 100644 index 0000000..fc79768 --- /dev/null +++ b/manifest_loader/storage.py @@ -0,0 +1,8 @@ +from django.contrib.staticfiles.storage import ManifestStaticFilesStorage + + +class DjangoManifestLoaderStorage(ManifestStaticFilesStorage): + """ + If a file isn’t found in the staticfiles.json manifest at runtime, don't raise an exception + """ + manifest_strict = False