Opened 9 years ago

Closed 5 years ago

Last modified 4 years ago

#6485 closed New feature (wontfix)

Split off file-serving capability

Reported by: Bastian Kleineidam <calvin@…> Owned by: nobody
Component: Uncategorized Version: master
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@…> 9 years ago.

Download all attachments as: .zip

Change History (11)

Changed 9 years ago by Bastian Kleineidam <calvin@…>

comment:1 Changed 9 years ago by jefurii

Triage Stage: UnreviewedDesign decision needed

comment:2 Changed 8 years ago by anonymous

milestone: post-1.0

comment:3 Changed 8 years ago by Thomas Güttler

Cc: hv@… added

comment:4 Changed 8 years ago by Thomas Güttler

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 Changed 8 years ago by (none)

milestone: post-1.0

Milestone post-1.0 deleted

comment:6 Changed 6 years ago by Julien Phalip

Type: New feature

comment:7 Changed 6 years ago by Julien Phalip

Severity: Normal

comment:8 Changed 5 years ago by Carl Meyer

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 Changed 5 years ago by Thomas Güttler

Cc: hv@… removed

comment:10 Changed 4 years ago by Benoît Bryon

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