[Twisted-Python] running several services from a single app

Jasper St. Pierre jstpierre at mecheye.net
Thu Mar 31 04:59:06 MDT 2011


The factory for twisted.web.resource Resources is twisted.web.server.Site

On Thu, Mar 31, 2011 at 4:45 AM, Aljoša Mohorović <
aljosa.mohorovic at gmail.com> wrote:

> now i looking at adding an wsgi app to this setup.
> i'm reading
> http://twistedmatrix.com/documents/current/web/howto/web-in-60/wsgi.html
> but can't figure out howto get factory for wsgi if i have:
>
> ===
> def application(environ, start_response):
>    start_response('200 OK', [('Content-type', 'text/plain')])
>    return ['Hello, world!']
> resource = WSGIResource(reactor, reactor.getThreadPool(), application)
> ===
>
> i'm looking for something like "reactor.listenTCP(10000,
> wsgi_factory)" but don't know howto do it.
> please point me to proper docs.
>

factory = Site(resource)
reactor.listenTCP(10000, factory)
reactor.run()

see here:
http://twistedmatrix.com/documents/current/web/howto/web-in-60/dynamic-content.html


> thanks
>
> Aljosa
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20110331/00c56805/attachment.html>


More information about the Twisted-Python mailing list