~justin-fathomdb/nova/justinsb-openstack-api-volumes

« back to all changes in this revision

Viewing changes to vendor/Twisted-10.0.0/doc/web/examples/web.py

  • Committer: Jesse Andrews
  • Date: 2010-05-28 06:05:26 UTC
  • Revision ID: git-v1:bf6e6e718cdc7488e2da87b21e258ccc065fe499
initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
 
3
# See LICENSE for details.
 
4
 
 
5
 
 
6
# This web server makes it possible to put it behind a reverse proxy
 
7
# transparently. Just have the reverse proxy proxy to 
 
8
# host:port/vhost/http/external-host:port/
 
9
# and on redirects and other link calculation, the external-host:port will
 
10
# be transmitted to the client.
 
11
 
 
12
from twisted.internet import reactor
 
13
from twisted.web import static, server, vhost, twcgi, script, trp
 
14
 
 
15
root = static.File("static")
 
16
root.processors = {
 
17
            '.cgi': twcgi.CGIScript,
 
18
            '.php3': twcgi.PHP3Script,
 
19
            '.php': twcgi.PHPScript,
 
20
            '.epy': script.PythonScript,
 
21
            '.rpy': script.ResourceScript,
 
22
            '.trp': trp.ResourceUnpickler,
 
23
}
 
24
root.putChild('vhost', vhost.VHostMonsterResource())
 
25
site = server.Site(root)
 
26
reactor.listenTCP(1999, site)
 
27
reactor.run()