Starting twisted service manually

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • qvx

    #1

    Starting twisted service manually

    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.applica tion import service, internet
    from twisted.interne t import reactor

    class Index(rend.Page ):
    ...


    # (2) part used when running via twistd
    application = service.Applica tion("my-app")
    internet.TCPSer ver(8080,
    appserver.Nevow Site(Index(r'D: \www'))).setSer viceParent(appl ication)


    # (3) attempt to start the same thing but inside a larger (wxPython)
    app
    def run_in_thread() :
    def runner():
    application = service.Applica tion("my-app")
    internet.TCPSer ver(8080,
    appserver.Nevow Site(Index(r'D: \www'))).setSer viceParent(appl ication)
    reactor.run(0)
    thread.start_ne w_thread(runner , ())


    I feel lost in twisted documentation and HOWTOs.

    Please help!

    Qvx

Working...