Setting up CherryPy

I am trying to set up for running a CherryPy app. This is my /var/ww/ :

import sys
sys.stdout = sys.stderr

import atexit
import threading
import cherrypy

cherrypy.config.update({'environment': 'embedded'})

if cherrypy.__version__.startswith('3.0') and cherrypy.engine.state == 0:

class Root(object):
    def index(self):
        return 'Hello World!' = True

application = cherrypy.Application(Root(), script_name=None, config=None)

This gives mes the following error though:

Unrecoverable error in the server. Traceback (most recent call last): File "/usr/local/lib/python2.7/site-packages/CherryPy-3.2.2-py2.7.egg/cherrypy/", line 571, in run self.script_name = File "/usr/local/lib/python2.7/site-packages/CherryPy-3.2.2-py2.7.egg/cherrypy/", line 83, in _get_script_name return cherrypy.serving.request.wsgi_environ['SCRIPT_NAME'].rstrip("/") KeyError: 'SCRIPT_NAME'

Any help would be appreciated.

Thanks, Tom

Try changing

application = cherrypy.Application(Root(), script_name=None, config=None)


application = cherrypy.Application(Root(), script_name='', config=None)

@bavaria_multi: Welcome to PA. I hope you have a Cherry of a time here...☺

Thanks very much! That did the trick :-)