Integrates uWSGI in Twisted
You can use uWSGI in Twisted environments.
The twuwsgi.py module implements a client resource to pass request to uwsgi:
# this is the uwsgi.tac file
from twuwsgi import *
from twisted.web2 import static
myapp = static.File('/var/lib/python-support/python2.6/django/contrib/admin/')
myapp.putChild('topolino', uWSGIClientResource('/pluto'))
myapp.putChild('django', uWSGIClientResource('/django'))
site = server.Site(myapp)
application = service.Application("uWSGI")
s = strports.service('tcp:8017', channel.HTTPFactory(site))
s.setServiceParent(application)
You will have three resource, one for static file and two for two different uWSGI applications.
or (for a single-app installation)
# this is the uwsgi.tac file
from twuwsgi import *
from twisted.web2 import static
myapp = uWSGIClientResource('',3017, '127.0.0.1')
site = server.Site(myapp)
application = service.Application("uWSGI")
s = strports.service('tcp:8017', channel.HTTPFactory(site))
s.setServiceParent(application)
Run it with:
twistd -n -y uwsgi.tac
uWSGIClientResource takes 0 to 3 args:
uWSGIClientResource(app, port, host)
if app is null it will default to '/' uWSGI application.
Currently only TCP mode is supported
