nginx git repository

Adrian Perez adrianperez at
Sun Oct 14 15:52:54 MSD 2007


First of all, sorry for the late reply, I have been quite busy lately.

On Fri, 05 Oct 2007 19:43:40 +0200
Manlio Perillo <manlio_perillo at> wrote:

> Adrian Perez de Castro ha scritto:
> > [...]
> > 
> >> Thanks a lot, will look into these. Did you try running bigger
> >> things a'la Django under mod_wsgi?
> > 
> > I tried to run Trac 0.10.4, MoinMoin 1.5.8 and the Bazaar 0.90 smart
> > server, without luck. As both are WSGI 1.0 applications, I did the
> > quick-and-dirt trick of wrapping them so they are exposed to Nginx
> > as WSGI 2.0 ones. I need to further investigate, but I suppose they
> > yielding more than a single result (which currently mod_wsgi does
> > not support, AFAIK).
> >  
> The current revision now fully supports WSGI 2.0, but does not yet 
> support asynchronous writes (I'm adding support right now).
> Can you send me the logs?
> The log level should be "info";

I will re-run the tests with log level set to "info", but I will first
update to the latest revision of the mod_wsgi module. I am using the
following Python snippet to adapt WSGI 1.0 apps to 2.0, they are a set
of decorators for WSGI applications, I hope they are ok although I have
not read the WSGI standard in depth:

---- <snip> ----

class Context(object):
    __slots__ = ("response", "headers")

    def __init__(self):
        self.response = None
        self.headers  = ()
    def __call__(self, response, headers):
        self.response = response
        self.headers  = headers

def wsgi1to2(application):
    """Converts a 1.0 app into a 2.0 app"""
    def wrapper(environ):
        context = Context()
        results = application(environ, context)
        return context.response, context.headers, results
    return wrapper

def returnone(application):
    """Makes a 2.0 app return only one element as result"""
    def wrapper(environ):
        response, headers, results = application(environ)
        return response, headers, "".join(results)
    return wrapper

def fornginx(application):
    """Applies the two above decorators, which is needed for
       a 1.0 application to work inside Nginx.
    return returnone(wsgi1to2(application))

---- </snip> ----


Los eclecticistas son los que hacen el gotelé.
        -- (Patxi)

More information about the nginx mailing list