[Django] #27929: Add an option when collecting statics to remove non-cached files after processing

22 views
Skip to first unread message

Django

unread,
Mar 11, 2017, 2:31:42 AM3/11/17
to django-...@googlegroups.com
#27929: Add an option when collecting statics to remove non-cached files after
processing
-----------------------------------------------+------------------------
Reporter: Jesse | Owner: nobody
Type: New feature | Status: new
Component: contrib.staticfiles | Version: 1.10
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------------+------------------------
When collecting statics with `CachedStaticFilesStorage` or
`ManifestStaticFilesStorage`, hashed versions of the files are created
along side the originals. The documentation
[https://docs.djangoproject.com/en/1.10/ref/contrib/staticfiles/#django.contrib.staticfiles.storage.ManifestStaticFilesStorage
specifically states that] this is intended to support any old links which
point to the original non-cached versions of the files. However, for a new
project, it's perfectly reasonable to not want to generate both sets of
static files once your project is being served on a production server.

--
Ticket URL: <https://code.djangoproject.com/ticket/27929>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Mar 14, 2017, 8:34:42 PM3/14/17
to django-...@googlegroups.com
#27929: Add an option when collecting statics to remove non-cached files after
processing
-------------------------------------+------------------------------------

Reporter: Jesse | Owner: nobody
Type: New feature | Status: new
Component: contrib.staticfiles | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+------------------------------------
Changes (by Tim Graham):

* stage: Unreviewed => Accepted


Comment:

I think it's okay, see ticket:24452#comment:17 and subsequent comments for
possibly related discussion.

--
Ticket URL: <https://code.djangoproject.com/ticket/27929#comment:1>

Django

unread,
Sep 16, 2017, 8:10:25 PM9/16/17
to django-...@googlegroups.com
#27929: Add an option when collecting statics to remove non-cached files after
processing
-------------------------------------+------------------------------------

Reporter: Jesse | Owner: nobody
Type: New feature | Status: new
Component: contrib.staticfiles | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+------------------------------------
Changes (by Ed Morley):

* cc: Ed Morley (added)


Comment:

I agree an option to remove the original files would be great.

Replying to [comment:1 Tim Graham]:


> I think it's okay, see ticket:24452#comment:17 and subsequent comments
for possibly related discussion.

So I think those comments were more about the intermediate files left
behind (eg `foo.<intermediate-hash>.css`) rather than the original files
(eg `foo.css`). For fixing the former there's ticket #28604, which would
likely do the right thing all the time, rather than being opt-in. However
I guess the same `CachedStaticFilesStorage` limitation might apply to the
original files too.

That said, given this feature would be opt-in, and could perhaps be made
to only support `ManifestStaticFilesStorage`, then perhaps this feature
could be added even before #28606 / #28604?

Fwiw, WhiteNoise rolls its own implementation to remove them currently:
https://github.com/evansd/whitenoise/blob/9d3ad51f7f05e5391ec6f2f03211d958a08e374f/whitenoise/storage.py#L32

...though I'm likely going to be revising it slightly to be more like:
https://github.com/moccu/barbeque/blob/dc714b4fa7ce2ad517a0d37474f8a774df46219c/barbeque/staticfiles/storage.py#L16-L17

--
Ticket URL: <https://code.djangoproject.com/ticket/27929#comment:2>

Django

unread,
Sep 16, 2017, 8:13:18 PM9/16/17
to django-...@googlegroups.com
#27929: Add ManifestStaticFilesStorage option to remove original (non-hashed) files
after processing
-------------------------------------+------------------------------------

Reporter: Jesse | Owner: nobody
Type: New feature | Status: new
Component: contrib.staticfiles | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+------------------------------------

--
Ticket URL: <https://code.djangoproject.com/ticket/27929#comment:3>

Django

unread,
Feb 22, 2023, 2:15:34 AM2/22/23
to django-...@googlegroups.com
#27929: Add ManifestStaticFilesStorage option to remove original (non-hashed) files
after processing
-------------------------------------+------------------------------------
Reporter: Jesse | Owner: nobody
Type: New feature | Status: new
Component: contrib.staticfiles | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+------------------------------------

Comment (by valleyofblackpanther):

Is this ticket still active?

--
Ticket URL: <https://code.djangoproject.com/ticket/27929#comment:4>

Django

unread,
Mar 5, 2023, 5:39:22 AM3/5/23
to django-...@googlegroups.com
#27929: Add ManifestStaticFilesStorage option to remove original (non-hashed) files
after processing
-------------------------------------+-------------------------------------
Reporter: Jesse | Owner: nobody
Type: New feature | Status: closed
Component: contrib.staticfiles | Version: 1.10
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by valleyofblackpanther):

* status: new => closed
* has_patch: 0 => 1
* resolution: => fixed
* stage: Accepted => Ready for checkin


Comment:

[PR]https://github.com/django/django/pull/16625

--
Ticket URL: <https://code.djangoproject.com/ticket/27929#comment:5>

Django

unread,
Mar 5, 2023, 6:19:59 AM3/5/23
to django-...@googlegroups.com
#27929: Add ManifestStaticFilesStorage option to remove original (non-hashed) files
after processing
-------------------------------------+------------------------------------
Reporter: Jesse | Owner: nobody
Type: New feature | Status: new
Component: contrib.staticfiles | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+------------------------------------
Changes (by Claude Paroz):

* status: closed => new
* resolution: fixed =>
* needs_tests: 0 => 1
* stage: Ready for checkin => Accepted


Comment:

Thanks for the patch! However a ticket is fixed when the pull request is
committed to main. And the `Ready for checkin` flag should only be set by
a reviewer of the patch.

--
Ticket URL: <https://code.djangoproject.com/ticket/27929#comment:6>

Django

unread,
Oct 1, 2023, 11:27:08 PM10/1/23
to django-...@googlegroups.com
#27929: Add ManifestStaticFilesStorage option to remove original (non-hashed) files
after processing
-------------------------------------+-------------------------------------
Reporter: Jesse | Owner: Umang
| Patel
Type: New feature | Status: assigned
Component: contrib.staticfiles | Version: 1.10

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* owner: nobody => Umang Patel
* needs_better_patch: 0 => 1
* status: new => assigned
* needs_docs: 0 => 1


Comment:

[https://github.com/django/django/pull/17328 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/27929#comment:7>

Django

unread,
Jul 24, 2025, 2:27:49 PM7/24/25
to django-...@googlegroups.com
#27929: Add ManifestStaticFilesStorage option to remove original (non-hashed) files
after processing
-------------------------------------+-------------------------------------
Reporter: Jesse | Owner: Umang
| Patel
Type: New feature | Status: assigned
Component: contrib.staticfiles | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by blighj):

This package I've been working on and hoping to get feedback on,
implements a solution for this ticket https://github.com/blighj/django-
manifeststaticfiles-enhanced
--
Ticket URL: <https://code.djangoproject.com/ticket/27929#comment:8>

Django

unread,
Aug 9, 2025, 1:35:47 PM8/9/25
to django-...@googlegroups.com
#27929: Add ManifestStaticFilesStorage option to remove original (non-hashed) files
after processing
-------------------------------------+------------------------------------
Reporter: Jesse | Owner: blighj
Type: New feature | Status: assigned
Component: contrib.staticfiles | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+------------------------------------
Changes (by blighj):

* needs_better_patch: 1 => 0
* needs_docs: 1 => 0
* needs_tests: 1 => 0
* owner: Umang Patel => blighj

--
Ticket URL: <https://code.djangoproject.com/ticket/27929#comment:9>

Django

unread,
Oct 11, 2025, 5:50:36 AM10/11/25
to django-...@googlegroups.com
#27929: Add ManifestStaticFilesStorage option to remove original (non-hashed) files
after processing
-------------------------------------+------------------------------------
Reporter: Jesse | Owner: blighj
Type: New feature | Status: assigned
Component: contrib.staticfiles | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+------------------------------------
Changes (by blighj):

* needs_better_patch: 0 => 1

Comment:

After talking with others at [[https://www.djangomed.eu|Django on the Med
🏖️]], this patch could be better handled at the collectstatic level.
Taking it out of the review queue, while I rework it.
--
Ticket URL: <https://code.djangoproject.com/ticket/27929#comment:10>
Reply all
Reply to author
Forward
0 new messages