Opened 17 years ago
Closed 17 years ago
#5157 closed (wontfix)
Direct Apache to serve a static file from view code
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Core (Other) | Version: | dev |
Severity: | Keywords: | apache, static file, feature | |
Cc: | Triage Stage: | Design decision needed | |
Has patch: | yes | Needs documentation: | yes |
Needs tests: | yes | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Django is not meant to be a static file server, but there is no easy method to direct Apache to serve a file. I have a use case where I need to authenticate a user and decide which static media file to pass back based on some model and view logic.
Usage:
if serve_static:
raise http.HttpInternalRedirect('/path/to/file/')
Attachments (1)
Change History (7)
by , 17 years ago
Attachment: | apache_redirect.diff added |
---|
comment:1 by , 17 years ago
Triage Stage: | Unreviewed → Design decision needed |
---|
comment:2 by , 17 years ago
What would this gain over having a view decide whether to serve the file or not, and then returning django.views.static.serve
with appropriate arguments?
comment:3 by , 17 years ago
The fact it doesn't have to feed the file through the Python interpreter.
comment:4 by , 17 years ago
Needs documentation: | set |
---|
comment:5 by , 17 years ago
Keywords: | feature added |
---|
comment:6 by , 17 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
This is too tightly coupled to mod_python for general inclusion. It's a good candidate for third-party exception middleware.
Very cool! Could you please bring this up in the Django Developers group to get some feedback?