[Twisted-Python] running a TurboGears from Twisted

David Konerding dakoner at gmail.com
Thu Mar 15 22:58:56 MDT 2007


Hi,

I want to run a turbogears site from inside Twisted via WSGI.  This isn't
documented, and I'm struggling to get it to work.  This is what I have so
far:

from twisted.web2 import wsgi
from twisted.application import service, strports
from twisted.web2 import server, channel
from twisted.python import util
from turbogears import update_config, start_server
from twisted.web2.wsgi import WSGIResource as WSGI
from cherrypy._cpwsgi import wsgiApp
import cherrypy
cherrypy.lowercase_api = True


# This part gets run when you run this file via: "twistd -noy demo.py"
if __name__ == '__builtin__':

    update_config(configfile="dev.cfg",modulename="quickie.config")
    test = WSGI(wsgiApp)

    # Create the site and application objects
    site = server.Site(test)
    application = service.Application("demo")

    # Serve it via standard HTTP on port 8080
    s = strports.service('tcp:8080', channel.HTTPFactory(site))
    s.setServiceParent(application)

I'm not having much luck with this, and I thought I'd check on the list if
anybody already had a recipe for this.

Thanks,
Dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20070315/99992fa9/attachment.html>


More information about the Twisted-Python mailing list