Rev | Line | |
---|
[579] | 1 | #!/usr/bin/python |
---|
[2386] | 2 | """Main FastCGI entry point for web interface""" |
---|
| 3 | |
---|
| 4 | import cherrypy |
---|
| 5 | import os |
---|
| 6 | import sys |
---|
| 7 | from main import InvirtWeb |
---|
| 8 | |
---|
| 9 | dev = False |
---|
| 10 | base_dir = os.path.dirname(__file__) |
---|
| 11 | |
---|
| 12 | if __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.