|
Hi there! I already posted this question in the forum, but since I could not figure out a solution yet, I thought I might try it again... GOAL: I want to serve protected static files from Django, so that I can assure, that only users that are logged in can access the files. EDIT: As I could not find a solution using the below mentioned setting, I looked at johns suggestion again... However it says "Support for mod_python has been deprecated within Django. At that time, this method of authentication will no longer be provided by Django." Though I could still make it work, it does not look like the way you should do it... Any other suggestions? What is the best way to reach the mentioned goal? CURRENT SETTING: 1) Passenger/Nginx: I installed the passenger application and configured nginx like this:
2) In the Webfaction panel I edit my site so that „/protected“ leads to the passenger app. 3) In django I try to access the files with the following code:
PROBLEM: As long as I leave the „internal“ in the nginx configuration, I cannot access the files (Nginx shows a 404). However, without the interal it works (that means the path should be correct). Is the request from the django app not handled as "internal"? Or does anyone see what the problem could be? Thanks for your help!!! |
Just for your information why I try it that way:
http://rocketscience.itteco.org/tag/x-sendfile/?
http://blog.zacharyvoase.com/2009/09/08/sendfile/
http://wiki.nginx.org/NginxXSendfile
You have to keep in mind, if you get this working for internal requests only, you will not be able to guarantee that only your users can access the files. If another user on the server makes a request to 127.0.0.1:<your_port>, your nginx will see it as internal and return your "protected" file.
In regards to mod_python, you would use mod_wsgi instead.