WSGI on Phusion Passenger

WSGI support is not documented in the Users guide because WSGI is mostly a proof of concept right now. But, just in case people want to tinker around with it, here’s how you can host a WSGI application on Phusion Passenger:

$ mkdir /webapps
$ mkdir /webapps/wsgi
$ cd /webapps/wsgi
$ mkdir public
$ mkdir tmp
$ some_favorite_editor passenger_wsgi.py
....edit file...
$ cat passenger_wsgi.py
def application(environ, start_response):
	start_response('200 OK', [('Content-type', 'text/plain'), ('X-Foo', 'bar')])
	return ['Hello World!<br><img src="http://www.squidz.com/c_snakey.jpg">']

Next, add a virtual host directive to your Apache config file:

<VirtualHost *:80>
    ServerName www.wsgi.test
    DocumentRoot /webapps/wsgi/public
</VirtualHost>

2 Comments »

  1. Kevin Evans said,

    June 11, 2008 @ 11:30 pm

    While a ‘proof of concept’, it does seem to work for Django ..

    http://github.com/kwe/passenger-django-wsgi-example/tree/django

  2. Nome do Jogo » Artigo » Rails Podcast Brasil - Episódio 21 said,

    June 19, 2008 @ 2:08 pm

    […] WSGI on Phusion […]

RSS feed for comments on this post · TrackBack URI

Leave a Comment