Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-release > by-pkgid > da3f2a4ce20b26cb5976aa965c74e071 > files > 3226

python2-twisted-19.2.0-1.mga7.armv7hl.rpm

# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.

"""
This demonstrates a web server which can run behind a name-based virtual hosting
reverse proxy.  It decodes modified URLs like:

    host:port/vhost/http/external-host:port/

and dispatches the request as if it had been received on the given protocol,
external host, and port.

Usage:
    python web.py
"""

from twisted.internet import reactor
from twisted.web import static, server, vhost, twcgi, script

root = static.File("static")
root.processors = {
            '.cgi': twcgi.CGIScript,
            '.epy': script.PythonScript,
            '.rpy': script.ResourceScript,
}
root.putChild('vhost', vhost.VHostMonsterResource())
site = server.Site(root)
reactor.listenTCP(1999, site)
reactor.run()