#6485 closed New feature (wontfix)
Split off file-serving capability
| Reported by: | Owned by: | nobody | |
|---|---|---|---|
| Component: | Uncategorized | Version: | dev |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Design decision needed | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
Split the file-serving capability of the Django static view into a
separate function, and add the ability to set the mimetype manually.
Note: I use the split off serve_file() to check certain (user) permissions prior to serving static content.
Attachments (1)
Change History (11)
by , 18 years ago
| Attachment: | 0010-Split-off-file-serving-capability.patch added |
|---|
comment:1 by , 18 years ago
| Triage Stage: | Unreviewed → Design decision needed |
|---|
comment:2 by , 17 years ago
| milestone: | → post-1.0 |
|---|
comment:3 by , 17 years ago
| Cc: | added |
|---|
comment:4 by , 17 years ago
comment:6 by , 15 years ago
| Type: | → New feature |
|---|
comment:7 by , 14 years ago
| Severity: | → Normal |
|---|
comment:8 by , 14 years ago
| Easy pickings: | unset |
|---|---|
| Resolution: | → wontfix |
| Status: | new → closed |
| UI/UX: | unset |
The recommended way to do permission-protected static files is by sending an X-SendFile header to the front-end webserver, and there are good third-party tools available for doing that with Django. Django's file-serving code is not intended for production use.
comment:9 by , 14 years ago
| Cc: | removed |
|---|
comment:10 by , 13 years ago
For the record, http://pypi.python.org/pypi/django-downloadview is a third-party tool designed for the use case explained in this ticket: register some "download view", decorate it (i.e. perform some actions with Django), then use X-SendFile headers to let the webserver deal with the serving.
As of 2012-12-04, only Nginx's X-Accel-Redirect is supported, but other servers could easily be added.
Splitting the file serving method to a separate method should include the change, that you
can use the underlaying sendfile (linux) or similar of the operating system.
Related: ticket #7894 and ticket #2131.