Created
April 28, 2011 02:43
-
-
Save felipe-prenholato/945692 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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