2 """Main FastCGI entry point for web interface"""
11 base_dir = os.path.dirname(__file__)
14 print >>sys.stderr, """%s [config]
16 Run server as FastCGI, with CherryPy config from "main.conf".
18 With `config`, run standalone with CherryPy config from `config`.
20 Run this script as either 'auth.fcgi' or 'unauth.fcgi', to get
21 the authenticated or unauthenticated site respectively.
25 if __name__ == "__main__":
29 if sys.argv[1] in ('-h', '--help'):
31 conf_file = sys.argv[1]
34 conf_file = os.path.join(base_dir, 'main.conf')
38 'tools.invirtwebstate.on': True,
42 if os.path.basename(sys.argv[0]).startswith('auth'):
44 elif os.path.basename(sys.argv[0]).startswith('unauth'):
45 root = InvirtUnauthWeb()
49 app = cherrypy.tree.mount(root, '/', app_config)
51 cherrypy.config.update(conf_file)
54 cherrypy.server.quickstart()
55 cherrypy.engine.start()
56 cherrypy.engine.block()
58 cherrypy.engine.start(blocking=False)
59 from flup.server.fcgi import WSGIServer
60 server = WSGIServer(cherrypy.tree)