Hi,

I look at your example code. You need to name the webserver in the
code. That's not very nice. I guess it should be possible to
guess the webserver (apache vs nginx) by looking at request.META.

Documentation would be nice....

  Thomas

On 25.03.2011 10:23, Gustavo Narea wrote:
> Hi all,
> 
> Just to let you know that there's an X-Sendfile implementation for
> WSGI apps (inc. Django), which also works with Nginx:
> https://launchpad.net/wsgi-xsendfile
> 
> You can use it in Django views via twod.wsgi. For example:
> 
> """
> from twod.wsgi import call_wsgi_app
> from xsendfile import NginxSendfile
> 
> file_sender = NginxSendfile('/var/www/docs')
> file_sender_wsgi_app = XSendfileApplication('/media/documents',
> file_sender)
> 
> def django_view(request, article_id):
>     article = Article.objects.get(article_id)
>     if it's foggy:
>         doc_response = call_wsgi_app(
>             file_sender_wsgi_app,
>             request,
>             article.path,
>             )
>     else:
>         doc_response = HttpResponseForbidden()
> 
>     return doc_response
> """
> 
> That package is pretty stable, the only thing it's missing is
> documentation which should be sorted soon.
> 
> Cheers.
> 
>  - Gustavo.


-- 
Thomas Guettler, http://www.thomas-guettler.de/
E-Mail: guettli (*) thomas-guettler + de

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to