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')
33 app = cherrypy.tree.mount(InvirtWeb(),
35 {'/': {'tools.staticdir.root': static_dir,
36 'tools.invirtwebstate.on': True},
37 '/static': {'tools.staticdir.on': True,
38 'tools.staticdir.dir': static_dir}
41 unauthApp = cherrypy.tree.mount(InvirtUnauthWeb(),
43 {'/': {'tools.invirtwebstate.on': True}})
44 unauthApp.merge(conf_file)
45 cherrypy.config.update(conf_file)
48 cherrypy.server.quickstart()
49 cherrypy.engine.start()
50 cherrypy.engine.block()
52 cherrypy.engine.start(blocking=False)
53 from flup.server.fcgi import WSGIServer
54 server = WSGIServer(cherrypy.tree)