source: package_branches/invirt-web/cherrypy-rebased/code/main.fcgi @ 2660

Last change on this file since 2660 was 2660, checked in by broder, 15 years ago

Basic CherryPy? FastCGI handler

  • Property svn:executable set to *
File size: 759 bytes
Line 
1#!/usr/bin/python
2"""Main FastCGI entry point for web interface"""
3
4import cherrypy
5import os
6import sys
7from main import InvirtWeb
8
9dev = False
10base_dir = os.path.dirname(__file__)
11
12if __name__=="__main__":
13    if len(sys.argv) > 1:
14        conf_file = sys.argv[1]
15        dev = True
16    else:
17        conf_file = os.path.join(base_dir, 'main.conf')
18    app = cherrypy.tree.mount(InvirtWeb(), '/' if dev else '/main.fcgi')
19    app.merge(conf_file)
20    cherrypy.config.update(conf_file)
21
22    if dev:
23        cherrypy.server.quickstart()
24        cherrypy.engine.start()
25        cherrypy.engine.block()
26    else:
27        cherrypy.engine.start(blocking=False)
28        from flup.server.fcgi import WSGIServer
29        server = WSGIServer(app)
30        server.run()
Note: See TracBrowser for help on using the repository browser.