Opened 8 years ago
Closed 3 years ago
#27541 closed New feature (duplicate)
Provide hooks to override manifest file storage in ManifestFilesMixin
Reported by: | Ryan Lopopolo | Owned by: | nobody |
---|---|---|---|
Component: | contrib.staticfiles | Version: | 1.10 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | yes |
Needs tests: | yes | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
My use case is that I would like to run collectstatic and store static assets in S3. However, I would like to store staticfiles.json locally so I can bake it into my deployment artifact.
It seems the only way to do this right now is to create a custom mixin like this one and override read_manifest and save_manifest to use a custom storage.
It seems the current behavior can be retained by using a FileSystemStorage with location = settings.STATIC_ROOT (aka self). Can we add a manifest_storage as an overridable property?
Attachments (1)
Change History (8)
comment:1 by , 8 years ago
Component: | Uncategorized → contrib.staticfiles |
---|---|
Type: | Uncategorized → New feature |
comment:2 by , 8 years ago
comment:3 by , 8 years ago
My intent is to add a layer of indirection to allow the manifest file to be saved to a separate storage backend than the static files themselves.
I've attached a patch. It should be backwards compatible.
comment:4 by , 8 years ago
The latest patch passes all tests when running
../venv/bin/python ./runtests.py staticfiles_tests.test_storage
I could not get the whole staticfiles suite to run
EDIT: I was doing something stupid. The entire suite passes on the master and stable/1.10.x branches.
comment:5 by , 8 years ago
Has patch: | set |
---|---|
Needs documentation: | set |
Needs tests: | set |
Triage Stage: | Unreviewed → Accepted |
It might be fine, I've not done much work with that code to say if there might be a better design. Anyway, at least docs and tests are also needed.
comment:6 by , 4 years ago
I'm going to close this as a duplicate of #27590 — both tickets are asking to allow configuration of where to store the manifest.
I'm not sure if I understand the suggestion, can you provide a patch? Will it be backwards compatible?