Opened 17 years ago

Closed 17 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: dev
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: no UI/UX: no

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@… 17 years ago.

Download all attachments as: .zip

Change History (7)

by mgiger@…, 17 years ago

Attachment: apache_redirect.diff added

comment:1 by Chris Beaven, 17 years ago

Triage Stage: UnreviewedDesign decision needed

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

comment:2 by James Bennett, 17 years ago

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 by Chris Beaven, 17 years ago

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

comment:4 by Chris Beaven, 17 years ago

Needs documentation: set

comment:5 by Philippe Raoult, 17 years ago

Keywords: feature added

comment:6 by Jacob, 17 years ago

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