Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import cherrypy
- from cherrypy import expose
- class Root(object):
- @expose
- def index(self):
- return "I am the root vhost"
- index.exposed = True
- class Foo(object):
- @expose
- def index(self):
- return "I am testingdomain.com"
- index.exposed = True
- class Bar(object):
- @expose
- def index(self):
- return "I am testingdomain2.com."
- index.exposed = True
- def main():
- #cherrypy.config.update("conf.ini")
- cherrypy.config.update({'server.socket_host': 'rootdomain.com',
- 'server.socket_port': 80,
- })
- conf = {
- "/": {
- "request.dispatch": cherrypy.dispatch.VirtualHost(
- **{
- "testingdomain.com:8000": "/foo",
- "testingdomain2.com:8000": "/bar"
- })
- }
- }
- root = Root()
- root.foo = Foo()
- root.bar = Bar()
- cherrypy.tree.mount(root, "/", conf)
- #cherrypy.quickstart()
- cherrypy.engine.start()
- cherrypy.engine.block()
- if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement