/usr/lib/python2.7/dist-packages/paste/script/twisted_web2_server.py is in python-pastescript 2.0.2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org)
# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
# @@: THIS IS INCOMPLETE!
def run_twisted(wsgi_app, global_conf,
host='127.0.0.1', port='8080'):
host = host or None
import twisted.web2.wsgi
import twisted.web2.log
import twisted.web2.channel
import twisted.web2.server
import twisted.internet.reactor
wsgi_resource = twisted.web2.wsgi.WSGIResource(wsgi_app)
resource = twisted.web2.log.LogWrapperResource(wsgi_resource)
twisted.web2.log.DefaultCommonAccessLoggingObserver().start()
site = twisted.web2.server.Site(resource)
factory = twisted.web2.channel.HTTPFactory(site)
# --- start reactor for listen port
twisted.internet.reactor.listenTCP(int(port), factory, interface=host)
twisted.internet.reactor.run()
|