django-static-precompiler icon indicating copy to clipboard operation
django-static-precompiler copied to clipboard

Incompatibility with `ManifestStaticFilesStorage`

Open alice-telescoop opened this issue 2 years ago • 0 comments

I cannot make ManifestStaticFileStorage` find the compiled css, even though it is on the right place. Here's my config :

STATICFILES_FINDERS = [
    "django.contrib.staticfiles.finders.FileSystemFinder",
    "django.contrib.staticfiles.finders.AppDirectoriesFinder",
    "static_precompiler.finders.StaticPrecompilerFinder",
]
STATICFILES_DIRS = [
    os.path.join(PROJECT_DIR, "static"),
]

# subclassing is to avoid ValueError but the file still isn't found
class LenientManifestStaticFileStorage(ManifestStaticFilesStorage):
    manifest_strict = False


STATICFILES_STORAGE = "labo.settings.base.LenientManifestStaticFileStorage"

The error I get when I let manifest_strict to True is:

/django/contrib/staticfiles/storage.py", line 465, in stored_name
    raise ValueError(
ValueError: Missing staticfiles manifest entry for 'COMPILED/css/pagination.css'

Indeed, there is mention of pagination.scss in staticfiles.json but none of COMPILED/pagination.css

ManifestStaticFilesStorage is the file storage system that is recommended in production and that's why we chose it. Also, the error only appears on DEBUG=True, but that is not too surprising since it is when ManifestStaticFilesStorage is actually used.

If anyone has an idea it would help a lot. I don't know if I missed anything, if someone has a workaround, if it was supposed to be supported at all.

alice-telescoop avatar Sep 27 '22 12:09 alice-telescoop