On 05/31/2012 09:43 AM, Daniel Bryan wrote: > Here's an example based on an application that I have in production. > It's a bit amateurish - and I'm going to mangle the language - but you > should get the idea. > > This is an extract from the main script: > > === > Class Handler(Resource): > pass # application code goes here - HTTP request handling, etc. > ... > If you run the above script, it will run Twisted from a trapped terminal. > > For deployment, I've built a server.tac file in the same directory: > > === > import twisted.application.service as Service > from twisted.application.service import IProcess > from twisted.application.internet import TCPServer > # append the working directory to sys.path so that we can import the > handler module > import sys > import os > sys.path.append(os.path.dirname(__file__)) > > import handler > > factory = handler.get_handler() > application = Service.Application('Data Collector') > IProcess(application).processName = 'data-collector' > TCPServer(8080, factory).setServiceParent(application) > === > > I can then run this command: > > === > twistd -y server.tac > === > > And it'll start up the server and daemonise the process, running it as > a service. > Shame on my lame brain !! So ... if currently my 'core' script is a tac file ... and the 'additional' script come in reactor.run style ... basically ... all I need is to 'import' the 'additional' to my current tac file.
Right ? Sincerely -bino- _______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python