Starting twisted service manually

qvx qvx3000 at gmail.com
Thu Sep 1 16:24:20 EDT 2005


I want to start twisted app from another GUI application and not via
twistd.
It works fine when started via twistd (1 & 2) but not when I try to
start it
manually (1 & 3) - nothing is listening to 8080 port.


# (1) common part
from nevow import rend, appserver
from twisted.application import service, internet
from twisted.internet import reactor

class Index(rend.Page):
    ...


# (2) part used when running via twistd
application = service.Application("my-app")
internet.TCPServer(8080,
appserver.NevowSite(Index(r'D:\www'))).setServiceParent(application)


# (3) attempt to start the same thing but inside a larger (wxPython)
app
def run_in_thread():
    def runner():
        application = service.Application("my-app")
        internet.TCPServer(8080,
appserver.NevowSite(Index(r'D:\www'))).setServiceParent(application)
        reactor.run(0)
    thread.start_new_thread(runner, ())


I feel lost in twisted documentation and HOWTOs.

Please help!

Qvx




More information about the Python-list mailing list