How to assign a wsgi application to cherrypy root via configuration file? I need a http: // localhost: 8080 / " request to go to my own wsgiapp. I use cherryd to start Cherrypy Server with the configuration file as follows:
Here's the call:
cherryd --config config.cfg --import myapp
Here is the config.cfg file:
[global]
server.socket_host: "127.0.0.1"
server.socket_port: 8080
tree.apps: { "/" : myapp.wsgiapp }
Here is the myapp.py module:
def wsgiapp(environ, start_response):
start_response('200 OK', [('Content-Type', 'text/plain')])
return ['Hello World']
This is where the error message appears:
File "/Users/samwan/Documents/myproject/virtual_environment/lib/python2.5/site-packages/CherryPy-3.1.2-py2.5.egg/cherrypy/_cpconfig.py", line 331, in _tree_namespace_handler
cherrypy.tree.graft(v, v.script_name)
AttributeError: 'dict' object has no attribute 'script_name'
source
share