Starting twisted service manually

Q

qvx

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top