views:

43

answers:

3

Is there a way for Apache to allow or deny a file download after checking with Django for permission?

That is, I want the user to have a permission within Django to determine if the user has the rights to a file. And, if the user has the permission, Apache would start the file download. Or, if the permission is not set for that user, the download is denied.

Thanks Eric

+1  A: 

I don't think it's possible like that. Why don't you serve the file through Django itself? See http://djangosnippets.org/snippets/365/

A: 

After more searching, I found this:

http://stackoverflow.com/questions/2294507/how-to-return-static-files-passing-through-a-view-in-django/2302520#2302520

I think this is what I will do.

Thanks! :)

Eric
That suggest loading whole thing into memory. Not really resource friendly. Second suggestion they give is redirect, it's fine but not bulletproof.