#24452: Staticfiles backends using HashedFilesMixin don't update CSS files' hash
when referenced media changes
-------------------------------------+-------------------------------------
Reporter: pmclanahan | Owner:
| pmclanahan
Type: Bug | Status: assigned
Component: contrib.staticfiles | Version: 1.7
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 pmclanahan):
It turns out I was a bit premature with my patch. I'm no longer convinced
this can be reasonably fixed considering the current architecture. The
problem is that the system needs to be able to calculate the hashed file
name at times other than when {{{collectstatic}}} is running, and even
during a run sometimes when the content of the modified file isn't
available. For example: the {{{CachedStaticFilesBackend}}} will sometimes
encounter a cache miss, so it must figure out what the hashed name should
be. The only data it has for this is the content of the original file
since it doesn't know how the file was modified and therefore can't
calculate the name if it's based on the modified contents.
The other situation I found is when a CSS file uses {{{@import}}} to bring
in another CSS file. Depending on the order in which the CSS files are
processed it may not have the calculated name of the imported file in the
cache yet, so it would need to calculate what the name will be, and it
only has the original file contents with which to do that.
This is solvable, but I fear it may take more of an overhaul of the
current architecture than is called for based on the severity of this bug.
I'm going to keep working on it, but this may block fixing this one.
--
Ticket URL: <https://code.djangoproject.com/ticket/24452#comment:7>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/068.6b8cf196ea561456fad20c5fb82c72e2%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.