[Twisted-Python] NT Service

Donovan Preston dp at twistedmatrix.com
Wed Mar 5 16:18:57 EST 2003


On Wednesday, March 5, 2003, at 01:01 PM, Thad Jacobs wrote:

[ snip snip ]

> def startTwisted():
>    from twisted.internet.app import Application
>
>    #How do I specify a port or load a tap file?
>    app = Application("web")

     # This is for creating a web root and listening on a port manually;
     # You could also probably load a tap but I don't know how.
     from twisted.web import server, static
     root = server.Site(static.File("c:\\web"))

     app.listenTCP(8080, site)

>    app.run(save=0)
>    print "Finished"
>
> if __name__=='__main__':
>    # you could call startTwisted to run as not-a-service
>    # or use it for cross-platform reasons
>    win32serviceutil.HandleCommandLine(KAQueryService)

mktap does the bit of code where you create the Site and File instances 
and call listenTCP. A good goal for making twisted better on windows 
(low on most priority lists since most of the twisted developers don't 
use windows) would be some sort of way to say "install this TAP as a 
service" which basically runs all that boilerplate; I have no idea 
about any of the details of how this would work though.

Hope this helps.

Donovan





More information about the Twisted-Python mailing list