2 """Main FastCGI entry point for web interface"""
7 from main import InvirtWeb, InvirtUnauthWeb
10 base_dir = os.path.dirname(__file__)
13 print >>sys.stderr, """%s [config]
15 Run server as FastCGI, with CherryPy config from "main.conf".
17 With `config`, run standalone with CherryPy config from `config`.
21 if __name__ == "__main__":
22 static_dir = os.path.join(base_dir, 'static')
27 if sys.argv[1] in ('-h', '--help'):
29 conf_file = sys.argv[1]
32 conf_file = os.path.join(base_dir, 'main.conf')
36 'tools.invirtwebstate.on': True,
39 'tools.staticdir.root': static_dir,
40 'tools.staticdir.on': True,
41 'tools.staticdir.dir': static_dir,
45 authApp = cherrypy.tree.mount(InvirtWeb(),
48 authApp.merge(conf_file)
49 unauthApp = cherrypy.tree.mount(InvirtUnauthWeb(),
52 unauthApp.merge(conf_file)
53 cherrypy.config.update(conf_file)
56 cherrypy.server.quickstart()
57 cherrypy.engine.start()
58 cherrypy.engine.block()
60 cherrypy.engine.start(blocking=False)
61 from flup.server.fcgi import WSGIServer
62 server = WSGIServer(cherrypy.tree)