[Twisted-Python] question about twisted+wxPython : How to migrate to twistd ?

Glyph glyph at twistedmatrix.com
Mon Jan 9 09:04:30 EST 2012


Hi Bino,

On Jan 9, 2012, at 12:39 AM, bino oetomo wrote:

> How to migrate that script to twistd, something like :

First of all, it's probably not appropriate to launch a WX GUI with twistd.  It's possible, but you don't get a lot of benefit.  If you are running in a GUI environment, your users likely have different expectations of logging, daemonization, etc, than they would with a background daemon.

Second, your script below looks mostly sensible; I assume that "MyRPC" is a version of MyXMLRPCApp that isn't a wx.App. I'm assuming that you want to run this as a .tac file, (i.e. with "twistd -y").  If that's the case, then you're on the right track.

> ------------------
> #Create Application
> application = service.Application("MultiService Example")
> #Create xmlrpc site
> myrpc = MyRPC()
> site = server.Site(myrpc)
> myrpcservice = internet.TCPServer(50008, site, interface='localhost')
> #Creating Multi Service
> multiService = service.MultiService()
> #Add our Services to multiservice
> myrpcservice.setServiceParent(multiService)
> #Set created application to be serviceparent of multiservice
> multiService.setServiceParent(application)
> ------------------

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20120109/d480eace/attachment.htm 


More information about the Twisted-Python mailing list