def run_twisted(apps, port, static_dir='.', interface='0.0.0.0'):
 import twisted.web.server
 import twisted.web.static
 from twisted.web.resource import Resource
 from twisted.web.wsgi import WSGIResource
 from twisted.internet import reactor
 if (static_dir != None):
  static_dir = os.path.abspath(static_dir)
  logging.info(('registering static folder %r on /' % static_dir))
  root = twisted.web.static.File(static_dir)
 else:
  root = Resource()
 for (app, url) in apps:
  resource = WSGIResource(reactor, reactor, app)
  logging.info(('registering %r on /%s' % (app, url)))
  root.putChild(url, resource)
 site = twisted.web.server.Site(root)
 reactor.listenTCP(port, site, interface=interface)
 logging.info(('listening on: %s:%d' % (interface, port)))
 return reactor.run()

def run_twisted ( apps , port , static_dir = '.' , interface = '0.0.0.0' ) : import twisted . web . server import twisted . web . static from twisted . web . resource import Resource from twisted . web . wsgi import WSGIResource from twisted . internet import reactor if ( static_dir != None ) : static_dir = os . path . abspath ( static_dir ) logging . info ( ( 'registering static folder %r on /' % static_dir ) ) root = twisted . web . static . File ( static_dir ) else : root = Resource ( ) for ( app , url ) in apps : resource = WSGIResource ( reactor , reactor , app ) logging . info ( ( 'registering %r on /%s' % ( app , url ) ) ) root . putChild ( url , resource ) site = twisted . web . server . Site ( root ) reactor . listenTCP ( port , site , interface = interface ) logging . info ( ( 'listening on: %s:%d' % ( interface , port ) ) ) return reactor . run ( )
twisted wrapper for the spyne .