Opened 2 months ago

Last modified 3 weeks ago

#28604 new Cleanup/optimization

Prevent ManifestStaticFilesStorage from leaving behind intermediate files

Reported by: Ed Morley Owned by:
Component: contrib.staticfiles Version: master
Severity: Normal Keywords: ManifestStaticFilesStorage, HashedFilesMixin
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Currently when using ManifestStaticFilesStorage, collectstatic generates duplicate versions of some files.

For example looking at the output for contrib.admin for Django 1.11.5, there is:

admin/css/base.css
admin/css/base.5af66c1b1797.css
admin/css/base.6b517d0d5813.css
admin/css/base.31652d31b392.css

This is exacerbated when using something like WhiteNoise's CompressedStaticFilesMixin, which then has to spend extra time generating gzip and Brotli compressed versions of every file (or else try and work around it: evansd/whitenoise#147).

This was called unavoidable/working as intended according to:
https://code.djangoproject.com/ticket/24452#comment:16
https://github.com/django/django/pull/6507

However now that it's looking like CachedStaticFilesStorage will end up being removed (mailing list thread; or at the very least we're discouraging people from using it, since it's buggy in several scenarios) - the intermediate files needn't be left behind.

Even before CachedStaticFilesStorage ends up being removed, we could perhaps add a keep_intermediate_files property to HashedFilesMixin, that is set to False for CachedStaticFilesStorage and True for ManifestStaticFilesStorage, allowing us to fix the latter in the meantime.

Change History (3)

comment:1 Changed 2 months ago by Tim Graham

Summary: Adjust HashedFilesMixin so it doesn't leave intermediate files behind for ManifestStaticFilesStoragePrevent ManifestStaticFilesStorage from leaving behind intermediate files
Triage Stage: UnreviewedAccepted
Type: BugCleanup/optimization

comment:2 Changed 4 weeks ago by Masataka Arai

Owner: changed from nobody to Masataka Arai
Status: newassigned

comment:3 Changed 3 weeks ago by Masataka Arai

Owner: Masataka Arai deleted
Status: assignednew
Note: See TracTickets for help on using tickets.
Back to Top