root/galaxy-central/eggs/PasteScript-1.7.3-py2.6.egg/paste/script/twisted_web2_server.py @ 3

リビジョン 3, 0.9 KB (コミッタ: kohda, 14 年 前)

Install Unix tools  http://hannonlab.cshl.edu/galaxy_unix_tools/galaxy.html

行番号 
1# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org)
2# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
3# @@: THIS IS INCOMPLETE!
4
5def run_twisted(wsgi_app, global_conf,
6                host='127.0.0.1', port='8080'):
7    host = host or None
8    import twisted.web2.wsgi
9    import twisted.web2.log
10    import twisted.web2.channel
11    import twisted.web2.server
12    import twisted.internet.reactor
13    wsgi_resource = twisted.web2.wsgi.WSGIResource(wsgi_app)
14    resource = twisted.web2.log.LogWrapperResource(wsgi_resource)
15    twisted.web2.log.DefaultCommonAccessLoggingObserver().start()
16    site = twisted.web2.server.Site(resource)
17    factory = twisted.web2.channel.HTTPFactory(site)
18    # --- start reactor for listen port
19    twisted.internet.reactor.listenTCP(int(port), factory, interface=host)
20    twisted.internet.reactor.run()
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。