posted on: 2010-05-18 15:06:01
In brief how-to run cherrypy behind apache on a small orange.

>So I found a broken forum that did not succeed or did not finish posting about running cherrypy on ASO behind apache.

Here is the recipe plain and simple. First learn how to setup a wsgi application via ASO, which uses passenger:

HOWTOPythonWSGI

Second look at how to run CherryPy behind a wsgi interface.

ModWSGI

Finally put 2+2 together and get a) a .htaccess file:

PassengerAppRoot $HOME/myproject

b) A passenger_wsgi.py file:

import sys
sys.stdout = sys.stderr
sys.path.append("$HOME/myproject")

import atexit
import threading
import cherrypy

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

if cherrypy.engine.state == 0:
    cherrypy.engine.start(blocking=False)
    atexit.register(cherrypy.engine.stop)

class MyProject(object):
    def index(self):
        return 'Project loaded'
    index.exposed = True

#I am placing this at /myproject
root = MyProject()
root.myproject = MyProject()

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

Note I added the line sys.path.append("$HOME/myproject") since that is where I installed cherrypy.

Comments

Name: