Fork me on GitHub

WSGI & Django Applications on Passenger

This post has been updated at 09/07/2011.

Quite cool thing I discovered recently is that you can deploy WSGI applications (Django etc) on Passenger. There is an example app for WSGI out there. Similarly as in Ruby, you have config.ru passenger_wsgi.py which looks like this (it's a slightly modified version of the linked example):

Quite cool thing I discovered recently is that you can deploy WSGI applications (Django etc) on Passenger. There is an example app for WSGI out there. Similarly as in Ruby, you have config.ru passenger_wsgi.py which looks like this (it's a slightly modified version of the linked example):

def application(environ, start_response):
  start_response('200 OK', [('Content-type', 'text/html'), ('X-Foo', 'bar')])
  return ['Hello World!']

And because Django have a WSGI handler, we can simply do something like (I took it from post Serve Django Projects with Phusion Passenger):

import os, sys
sys.path.append('/path/to/your/DjangoProjects')
os.environ['DJANGO_SETTINGS_MODULE'] = 'example_com.settings'

import django.core.handlers.wsgi

application = django.core.handlers.wsgi.WSGIHandler()

Add vhost for the application and you're done!

blog comments powered by Disqus
About

RSS

All Posts IT Python Django WSGI Phusion Passenger Apache

Tags

GitHub projects

Twitter @botanicus

Recent Comments