Opened 8 years ago

Closed 4 years ago

Last modified 3 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@…> 8 years ago.

Download all attachments as: .zip

Change History (11)

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

comment:1 Changed 7 years ago by jefurii

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Design decision needed

comment:2 Changed 7 years ago by anonymous

  • milestone set to post-1.0

comment:3 Changed 7 years ago by guettli

  • Cc hv@… added

comment:4 Changed 7 years ago by guettli

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 7 years ago by anonymous

  • milestone post-1.0 deleted

Milestone post-1.0 deleted

comment:6 Changed 4 years ago by julien

  • Type set to New feature

comment:7 Changed 4 years ago by julien

  • Severity set to Normal

comment:8 Changed 4 years ago by carljm

  • Easy pickings unset
  • Resolution set to wontfix
  • Status changed from new to 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 Changed 4 years ago by guettli

  • Cc hv@… removed

comment:10 Changed 3 years ago by benoitbryon

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