Changeset 2387


Ignore:
Timestamp:
Aug 9, 2009, 6:45:20 PM (15 years ago)
Author:
quentin
Message:

Mount static resources so they can be accessed via CherryPy?

File:
1 edited

Legend:

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

    r2386 r2387  
    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.