#NEWLINE# def setup_server( ) : #NEWLINE# #INDENT# class Root ( ) : #NEWLINE# #INDENT# def index( self ) : #NEWLINE# #INDENT# return 'Hello, world' #NEWLINE# #UNINDENT# index . exposed = True #NEWLINE# def dom4( self ) : #NEWLINE# #INDENT# return 'Under construction' #NEWLINE# #UNINDENT# dom4 . exposed = True #NEWLINE# def method( self , value ) : #NEWLINE# #INDENT# return ( 'You sent %s' % value ) #NEWLINE# #UNINDENT# method . exposed = True #NEWLINE# #UNINDENT# class VHost ( ) : #NEWLINE# #INDENT# def __init__( self , sitename ) : #NEWLINE# #INDENT# self . sitename = sitename #NEWLINE# #UNINDENT# def index( self ) : #NEWLINE# #INDENT# return ( 'Welcome to %s' % self . sitename ) #NEWLINE# #UNINDENT# index . exposed = True #NEWLINE# def vmethod( self , value ) : #NEWLINE# #INDENT# return ( 'You sent %s' % value ) #NEWLINE# #UNINDENT# vmethod . exposed = True #NEWLINE# def url( self ) : #NEWLINE# #INDENT# return cherrypy . url ( 'nextpage' ) #NEWLINE# #UNINDENT# url . exposed = True #NEWLINE# static = cherrypy . tools . staticdir . handler ( section = '/static' , dir = curdir ) #NEWLINE# #UNINDENT# root = Root ( ) #NEWLINE# root . mydom2 = VHost ( 'Domain 2' ) #NEWLINE# root . mydom3 = VHost ( 'Domain 3' ) #NEWLINE# hostmap = { #NEWLINE# #INDENT# 'www.mydom2.com' : '/mydom2' , #NEWLINE# 'www.mydom3.com' : '/mydom3' , #NEWLINE# 'www.mydom4.com' : '/dom4' , #NEWLINE# #UNINDENT# } #NEWLINE# cherrypy . tree . mount ( hostmap , config = { #NEWLINE# #INDENT# '/' : { #NEWLINE# #INDENT# 'request.dispatch' : cherrypy . dispatch . VirtualHost ( ** hostmap ) , #NEWLINE# #UNINDENT# } , #NEWLINE# '/mydom2/static2' : { #NEWLINE# #INDENT# 'tools.staticdir.on' : True , #NEWLINE# 'tools.staticdir.root' : curdir , #NEWLINE# 'tools.staticdir.dir' : 'static' , #NEWLINE# 'tools.staticdir.index' : 'index.html' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } )