Last change
on this file since 2396 was
2387,
checked in by quentin, 15 years ago
|
Mount static resources so they can be accessed via CherryPy?
|
-
Property svn:executable set to
*
|
File size:
990 bytes
|
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__": |
---|
[2387] | 13 | static_dir = os.path.join(base_dir, 'static') |
---|
| 14 | |
---|
[2386] | 15 | if len(sys.argv) > 1: |
---|
| 16 | conf_file = sys.argv[1] |
---|
| 17 | dev = True |
---|
| 18 | else: |
---|
| 19 | conf_file = os.path.join(base_dir, 'main.conf') |
---|
[2387] | 20 | app = cherrypy.tree.mount(InvirtWeb(), |
---|
| 21 | '/' if dev else '/main.fcgi', |
---|
| 22 | {'/': {'tools.staticdir.root': static_dir}, |
---|
| 23 | '/static': {'tools.staticdir.on': True, |
---|
| 24 | 'tools.staticdir.dir': static_dir} |
---|
| 25 | }) |
---|
[2386] | 26 | app.merge(conf_file) |
---|
| 27 | cherrypy.config.update(conf_file) |
---|
| 28 | |
---|
| 29 | if dev: |
---|
| 30 | cherrypy.server.quickstart() |
---|
| 31 | cherrypy.engine.start() |
---|
| 32 | cherrypy.engine.block() |
---|
| 33 | else: |
---|
| 34 | cherrypy.engine.start(blocking=False) |
---|
| 35 | from flup.server.fcgi import WSGIServer |
---|
| 36 | server = WSGIServer(app) |
---|
| 37 | server.run() |
---|
Note: See
TracBrowser
for help on using the repository browser.