I am using Phusion Passenger having a ruby application and I'd like to put it together to utilize an django appengine application I am focusing on.

Searching for "passenger_wsgi.py" I could obtain the following quite simple non-django application focusing on passenger:

passenger_wsgi.py:

def application(environ, start_response):
   response_headers = [('Content-type','text/plain')]
   start_response('200 OK', response_headers)
   return ['Hello World!\n']

However, basically add the road import django.core.handlers.wsgi in to the mix, I recieve 'An error happened posting your passenger_wsgi.py'. By making the sys.path I have learned that a minimum of area of the reason happens because Passenger is applying the incorrect python installation on my small machine.

How do i configure Passenger (on apache) to make use of /opt/local/bin/python2.5 rather than the machine default python?

I came across when I transformed the hashbang in the first type of passenger's request_handler.py file to #!/opt/local/bin/python2.5, passenger used the right python. But surely there has to be an easy method than modifying passenger's distribution?

One trick would be to incorporate a line such as this inside your passenger_wsgi.py file:

if sys.version < "2.4":
os.execl("/usr/bin/python2.4", "python2.4", *sys.argv)

or

INTERP = "/usr/local/bin/python"
if sys.executable != INTERP:
os.execl(INTERP, INTERP, *sys.argv)

All these essentially informs the atmosphere to apply your preferred python.