views:

9

answers:

1

This is what I found that in theory should work from git hub.com passenger-pylons-wsgi-example

import os, sys
sys.path.append('/home/user/test.sample.com/Helloworld')
os.environ['PYTHON_EGG_CACHE'] = '/home/user/tmp'

from paste.deploy import loadapp

def application(environ, start_response):
environ['SCRIPT_NAME'] = environ['PATH_INFO']
application = loadapp('config:/home/user/test.sample.com/production.ini')

return application(environ, start_response)

Tried it on dreamhost and I get: An error occurred importing your passenger_wsgi.py

I also tried the virtual environment but it didn't seem to work either.

mind you after following the instructions I have python 2.6 but no activate in the virtual directory.

Any ideas?

I also tried adding:

from fcgi import WSGIServer

and after the def application:

server = WSGIServer(application) server.run()

But still get the same error. I wish it was a bit more descriptive so I could debug the passenger_wsgi

+1  A: 

Finally found my answer:

import os, sys
INTERP = "/home/user/local/bin/python" if sys.executable != INTERP: os.execl(INTERP, INTERP, *sys.argv)
sys.path.append('/home/user/test.sample.com/Helloworld')
os.environ['PYTHON_EGG_CACHE'] = '/home/user/tmp'

from paste.deploy import loadapp

def application(environ, start_response):
environ['SCRIPT_NAME'] = environ['PATH_INFO']
application = loadapp('config:/home/denat/test.sample.com/production.ini')
return application(environ, start_response)

============== The difference here is that the virtual environment was setup with pylons but wasn't using it. From the wiki on dreamhost I needed to add the following lines:

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

I now have a working pylons app! Yay!

I know others have been looking for this so I hope this helps them.

Dean