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

Last change on this file since 2695 was 2692, checked in by broder, 14 years ago

Unauthenticated front page

  • Property svn:executable set to *
File size: 1.2 KB
RevLine 
[579]1#!/usr/bin/python
[2660]2"""Main FastCGI entry point for web interface"""
3
4import cherrypy
5import os
6import sys
[2692]7from main import InvirtWeb, InvirtUnauthWeb
[2660]8
9dev = False
10base_dir = os.path.dirname(__file__)
11
12if __name__=="__main__":
[2661]13    static_dir = os.path.join(base_dir, 'static')
14
[2660]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')
[2661]20    app = cherrypy.tree.mount(InvirtWeb(),
[2681]21        '/',
[2669]22        {'/':      {'tools.staticdir.root': static_dir,
23                    'tools.invirtwebstate.on': True},
[2661]24        '/static': {'tools.staticdir.on': True,
25                    'tools.staticdir.dir': static_dir}
26         })
[2660]27    app.merge(conf_file)
[2692]28    unauthApp = cherrypy.tree.mount(InvirtUnauthWeb(),
29                                    '/unauth',
30                                    {'/': {'tools.invirtwebstate.on': True}})
31    unauthApp.merge(conf_file)
[2660]32    cherrypy.config.update(conf_file)
33
34    if dev:
35        cherrypy.server.quickstart()
36        cherrypy.engine.start()
37        cherrypy.engine.block()
38    else:
39        cherrypy.engine.start(blocking=False)
40        from flup.server.fcgi import WSGIServer
[2692]41        server = WSGIServer(cherrypy.tree)
[2660]42        server.run()
Note: See TracBrowser for help on using the repository browser.