2 """Main FastCGI entry point for authenticated web interface"""
7 from main import InvirtWeb
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 app = cherrypy.tree.mount(InvirtWeb(),
49 cherrypy.config.update(conf_file)
52 cherrypy.server.quickstart()
53 cherrypy.engine.start()
54 cherrypy.engine.block()
56 cherrypy.engine.start(blocking=False)
57 from flup.server.fcgi import WSGIServer
58 server = WSGIServer(cherrypy.tree)