def start_server(self, options): if options.get('reload'): from utils.autoreload import main while True: try: main(self.run_jabber_client) except KeyboardInterrupt: break else: self.run_jabber_client()
#!/usr/bin/env python from twisted.internet import reactor from settings import settings from webserver.site import site def main(): print 'Start listening on http://localhost:8080/' reactor.listenTCP(8080, site) reactor.run() if __name__ == '__main__': from utils import autoreload autoreload.main(main, root=settings.PROJECT_ROOT, extensions=['.py', '.jinja2', '.jstmpl'] )
#!/usr/bin/env python # coding: utf-8 """ run.py Run twisted with autoload. Created by Daniel Yang on 2011-02-24. Copyright (c) 2011 __MyCompanyName__. All rights reserved. """ from twisted.scripts import twistd from utils import autoreload autoreload.main(twistd.run)