Opened 9 years ago

Closed 9 years ago

#5157 closed (wontfix)

Direct Apache to serve a static file from view code

Reported by: mgiger@… Owned by: nobody
Component: Core (Other) Version: master
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: UI/UX:

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)

apache_redirect.diff (2.1 KB) - added by mgiger@… 9 years ago.

Download all attachments as: .zip

Change History (7)

Changed 9 years ago by mgiger@…

Attachment: apache_redirect.diff added

comment:1 Changed 9 years ago by Chris Beaven

Triage Stage: UnreviewedDesign decision needed

Very cool! Could you please bring this up in the Django Developers group to get some feedback?

comment:2 Changed 9 years ago by James Bennett

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 Changed 9 years ago by Chris Beaven

The fact it doesn't have to feed the file through the Python interpreter.

comment:4 Changed 9 years ago by Chris Beaven

Needs documentation: set

comment:5 Changed 9 years ago by Philippe Raoult

Keywords: feature added

comment:6 Changed 9 years ago by Jacob

Resolution: wontfix
Status: newclosed

This is too tightly coupled to mod_python for general inclusion. It's a good candidate for third-party exception middleware.

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