It would be nice if there were an admonition in
[https://docs.djangoproject.com/en/dev/howto/static-files/#serving-static-
files-during-development the Serving static files during development docs]
to say as much, especially given that if you ''don't'' have
`django.contrib.staticfiles` in your `INSTALLED_APPS` and instead have
opted for using `+= static(settings.STATIC_URL,
document_root=settings.STATIC_ROOT)` for whatever reason, those requests
**do** go through the middleware chain.
Perhaps worth noting that the subject came up independently in #32891 and
despite reading that thread, I'd entirely forgotten that `staticfiles` was
abnormal in that respect, in just 8 weeks...
Of course, I'm also open to changing it to go through the middleware chain
like a normal request (which would look to involve removing `get_response`
in favour of `resolve_request` ... or just changing it to be a middleware)
;)
--
Ticket URL: <https://code.djangoproject.com/ticket/33048>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* stage: Unreviewed => Accepted
Comment:
Hey Keryn. 😀
Having been confused on #32891, I agree that this is confusing. (X
weeks/months/years since I thought about this, why doesn't it work the
same as everything else… 🤔. Repeat.)
If you want to document this, super. …
> Of course, I'm also open to changing it to go through the middleware
chain like a normal request ...
Sketching that up as a proposal would likely be worth a discussion on the
DevelopersMailingList (I mean that's on the road to #27325 no...? 😜)
--
Ticket URL: <https://code.djangoproject.com/ticket/33048#comment:1>
* owner: nobody => valleyofblackpanther
* status: new => assigned
Comment:
This is more than an edit on the document. We have to consider various
interconnected technical issues.
--
Ticket URL: <https://code.djangoproject.com/ticket/33048#comment:2>
* has_patch: 0 => 1
Comment:
Hi everyone. I am Kaushik. So you can see that from the ticket that it
needed some edit on the documentation, and I did the needed refraction to
it. I added a note to the documentation explaining the role of middleware
during serving the static files, explaining the role of runserver and how
it overrides per se, and how it doesn't run MIDDLEWARE. The documentation
is well versed but it didn't mention anything about the middleware
function. This note will help first-time readers to give them an
insightful mechanism of how it automatically serves static files. This is
my first pull request during my Django contribution
[https://github.com/django/django/pull/15159] If you have anything to add
to it or feel like it doesn't make any sense kind of feeling, mention it
below the comments, we'll try to negotiate and come to terms where it will
serve both our interests to the contribution.
--
Ticket URL: <https://code.djangoproject.com/ticket/33048#comment:3>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/33048#comment:4>
* needs_better_patch: 1 => 0
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/33048#comment:5>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"f4de87038ef3adfe8c67ede6c3c5519451abe6cc" f4de8703]:
{{{
#!CommitTicketReference repository=""
revision="f4de87038ef3adfe8c67ede6c3c5519451abe6cc"
[4.0.x] Fixed #33048 -- Doc'd that DEBUG static files requests don't use
middleware chain.
Backport of 1625a8c8eba0b00ebdd1d7a8ba697b2729ec40ed from main
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/33048#comment:7>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"1625a8c8eba0b00ebdd1d7a8ba697b2729ec40ed" 1625a8c8]:
{{{
#!CommitTicketReference repository=""
revision="1625a8c8eba0b00ebdd1d7a8ba697b2729ec40ed"
Fixed #33048 -- Doc'd that DEBUG static files requests don't use
middleware chain.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/33048#comment:6>