Initialize in a function so it's not invoked on import
@@ -77,6 +77,8 @@ class Root:
return resp
+def init():
+
cherrypy.config.update({
'log.error.file': '',
'environment': 'production',
@@ -98,7 +100,9 @@ appconf = {
'tools.staticdir.root': curdir,
},
}
-app = cherrypy.tree.mount(Root(), SCRIPT_NAME, appconf)
+ globals().update(
+ app=cherrypy.tree.mount(Root(), SCRIPT_NAME, appconf),
+ )
class NullRequest:
@@ -353,6 +357,8 @@ def run_modpython(use_wsgi=False):
if __name__ == '__main__':
+ init()
+
longopts = ['cpmodpy', 'modpython', 'null', 'notests',
'help', 'ab=', 'apache=']
try:
