Skip to content

Instantly share code, notes, and snippets.

@felipe-prenholato
Created April 28, 2011 02:43
Show Gist options
  • Save felipe-prenholato/945692 to your computer and use it in GitHub Desktop.
Save felipe-prenholato/945692 to your computer and use it in GitHub Desktop.
import os
import sys
# this make that any print goes to stderr and than, apache error log
sys.stdout = sys.stderr
os.environ['DJANGO_SETTINGS_MODULE'] = 'portal.settings'
sys.path.append('/var/www/qas2')
sys.path.append('/var/www/qas2/portal')
# Django can live on diferent paths on system.
# This 'if's check what is directory where django live.
#
# cent os, production
if os.path.isdir('/usr/lib/python2.6/site-packages/django'):
sys.path.append('/usr/lib/python2.6/site-packages')
# ubuntu 10.10 via python setup.py install
elif os.path.isdir('/usr/local/lib/python2.6/site-packages/django'):
sys.path.append('/usr/local/lib/python2.6/site-packages')
# ubuntu 10.10 via pip install
elif os.path.isdir('/usr/local/lib/python2.6/dist-packages/django'):
sys.path.append('/usr/local/lib/python2.6/dist-packages')
#print sys.path
import django.core.handlers.wsgi
def application(environ, start_response):
status = '200 OK'
output = 'Hello World!'
response_headers = [('Content-type', 'text/plain'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]
application = django.core.handlers.wsgi.WSGIHandler()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment