The main advantages I can think of when running with Twisted/Twistd is that:
- All Python solution (if that really is an advantage)
- Ability to run other twisted services. Did you want RPC, Email, FTP, remote shell etc for free?
- Twisted authorization framework
First make a tac file, which you will be running with the old favourite:
twistd -ny mytac.tac
On to some code:
# This is my process for creating my WSGI application. You may have other methods.
from graelsite.www.application import make_app
from graelsite.www import config
wsgi_app = make_app(config)
# Now on to the real stuff
from twisted.application import service, strports
from twisted.web2 import server, channel, wsgi
application = service.Application('web2-wsgi') # call this anything you like
site = server.Site(wsgi.WSGIResource(wsgi_app))
s = strports.service('tcp:9876', channel.HTTPFactory(site))
And I honestly think that is the easiest way to deploy a WSGI application (outside the safety of Cherry, Paster, Werkzeug, etc.).
Note: Werkzeug is excellent, use it!