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)

manifest_storage.patch (1.6 KB ) - added by Ryan Lopopolo 8 years ago.
manifest_storage indirection

Download all attachments as: .zip

Change History (8)

comment:1 by Ryan Lopopolo, 8 years ago

Component: Uncategorizedcontrib.staticfiles
Type: UncategorizedNew feature

comment:2 by Tim Graham, 8 years ago

I'm not sure if I understand the suggestion, can you provide a patch? Will it be backwards compatible?

comment:3 by Ryan Lopopolo, 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.

Version 0, edited 8 years ago by Ryan Lopopolo (next)

by Ryan Lopopolo, 8 years ago

Attachment: manifest_storage.patch added

manifest_storage indirection

comment:4 by Ryan Lopopolo, 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.

Last edited 8 years ago by Ryan Lopopolo (previous) (diff)

comment:5 by Tim Graham, 8 years ago

Has patch: set
Needs documentation: set
Needs tests: set
Triage Stage: UnreviewedAccepted

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 Carlton Gibson, 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.

comment:7 by Mariusz Felisiak, 3 years ago

Resolution: duplicate
Status: newclosed

Duplicate of #27590.

Note: See TracTickets for help on using tickets.
Back to Top