Opened 17 years ago

Closed 13 years ago

Last modified 12 years ago

#6485 closed New feature (wontfix)

Split off file-serving capability

Reported by: Bastian Kleineidam <calvin@…> 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)

0010-Split-off-file-serving-capability.patch (1.5 KB ) - added by Bastian Kleineidam <calvin@…> 17 years ago.

Download all attachments as: .zip

Change History (11)

by Bastian Kleineidam <calvin@…>, 17 years ago

comment:1 by jefurii, 17 years ago

Triage Stage: UnreviewedDesign decision needed

comment:2 by anonymous, 16 years ago

milestone: post-1.0

comment:3 by Thomas Güttler, 16 years ago

Cc: hv@… added

comment:4 by Thomas Güttler, 16 years ago

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.

comment:5 by (none), 16 years ago

milestone: post-1.0

Milestone post-1.0 deleted

comment:6 by Julien Phalip, 14 years ago

Type: New feature

comment:7 by Julien Phalip, 13 years ago

Severity: Normal

comment:8 by Carl Meyer, 13 years ago

Easy pickings: unset
Resolution: wontfix
Status: newclosed
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 Thomas Güttler, 13 years ago

Cc: hv@… removed

comment:10 by Benoît Bryon, 12 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.

Note: See TracTickets for help on using tickets.
Back to Top