python - run cherryPy webapp outside main directory -
i have cherrypy application, test.py (the 1 has cherrypy)is inside root/folder1/folder2 , running python root.
when defining index.html have specify path return open('folder1/folder2/index.html') otherwise wouldn't recognize it. when running application / works, /session doesn't. there anyway fix it. here snippet of code: note java script file inside static folder , works fine
server_path = os.path.abspath(os.path.dirname(__file__)) conf = { 'global': { 'server.socket_host': '0.0.0.0', 'server.socket_port': 8080 }, '/': { 'tools.sessions.on': true, 'tools.staticdir.root': os.path.join(server_path) }, '/session': { 'request.dispatch': cherrypy.dispatch.methoddispatcher(), 'tools.response_headers.on': true, }, '/static': { 'tools.staticdir.on': true, 'tools.staticdir.dir': './static' }
}
Comments
Post a Comment