Hi,
I want to run a TurboGears installation from Twisted. I've made a first
pass at implementing this but I've still got a few problems.
I need twisted because I am integrating some web services code that uses ZSI
and it uses the Twisted
reactor to schedule asynchronous operations.
>From what I can tell, Twisted's WSGI support runs requests in a thread
pool. I'll handle all the necessary dispatching of twisted-related
calls from the TurboGears application threads using twisted's standard
thread-safe calls.
Here's what I've got. The problem is that the visiting the root of site
sends a series of redirects
### save as 'start-twisted.py'
### then run using 'twistd -noy start-twisted.py'
from twisted.application import service, strports
from twisted.web2 import server, channel
from twisted.web2 import static
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
from quickie.controllers import Root
import pkg_resources
pkg_resources.require("TurboGears")
cherrypy.root = Root()
#cherrypy.tree.mount(Root())
cherrypy.server.start(initOnly=True, serverClass=None)
update_config(configfile="dev.cfg",modulename="quickie.config")
resource = WSGI(wsgiApp)
site = server.Site(resource)
application = service.Application("demo")
s = strports.service('tcp:8080', channel.HTTPFactory(site))
s.setServiceParent(application)
Visiting the URL gives me:
This resource resides temporarily at <a href='http://localhost:8080/'>
http://localhost:8080/</a>.
Also, when I start the twistd application it looks like the startup script
is actually being
sourced twice! Something in the cherrypy.server.start thing seems to be
relaunching the Python executable.
Dave
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---