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 which looks like this (it's a slightly modified version of the linked example):
config.ru passenger_wsgi.py
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 which looks like this (it's a slightly modified version of the linked example):config.ru passenger_wsgi.py
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