Changeset 2661


Ignore:
Timestamp:
Dec 20, 2009, 9:43:45 PM (15 years ago)
Author:
broder
Message:

Mount static resources so they can be accessed via CherryPy?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • package_branches/invirt-web/cherrypy-rebased/code/main.fcgi

    r2660 r2661  
    1111
    1212if __name__=="__main__":
     13    static_dir = os.path.join(base_dir, 'static')
     14
    1315    if len(sys.argv) > 1:
    1416        conf_file = sys.argv[1]
     
    1618    else:
    1719        conf_file = os.path.join(base_dir, 'main.conf')
    18     app = cherrypy.tree.mount(InvirtWeb(), '/' if dev else '/main.fcgi')
     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         })
    1926    app.merge(conf_file)
    2027    cherrypy.config.update(conf_file)
Note: See TracChangeset for help on using the changeset viewer.