On Tue, Sep 22, 2009 at 10:12 AM, Charles Wang <wangyua...@gmail.com> wrote: > I have a question for "make apache deliver it". How to control the > access right? Integrate apache access auth model with Django?
not exactly, the idea is that the file isn't under apache's DocumentRoot, so it won't have it's own URL. instead, you have your Django view that would serve the file by reading it and stuffing the data in the HttpResponse object. something like that: def servefile(request): --- verify that the user is allowed --- data = open('filepathname').read() return HttpResponse (data) but that makes Django serve the data itself, not a good situation. so, stop short of actually reading the file, and tell apache to to it: def servefile(request): -- verify that the user is allowed --- resp = HttpResponse () resp['X-SendFile'] = 'filepathname' return resp note, i've done this with NginX (which uses 'X-Accelerate' instead of 'X-SendFile'), but i've heard it works on Apache too -- Javier --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---