SEESenv/web/hgbook/run.wsgi~
author amit@thunder
Mon, 22 Feb 2010 18:22:21 +0530
changeset 22 a27f1e69d966
parent 21 5f66214fce86
permissions -rw-r--r--
testing .. I am really confused about how to handle the change of repos from /home/amit to /home/hg

import os
home_dir=os.getenv("HOME")
if home_dir=='/home/amit':
    ALLDIRS = ['/home/amit/SEES-hacks/SEESenv/lib/python2.6/site-packages']
else:
    ALLDIRS = ['/home/hg/repos/SEES-hacks/SEESenv/lib/python2.6/site-packages']
import sys 
import site 

# Remember original sys.path.
prev_sys_path = list(sys.path) 

# Add each new site-packages directory.
for directory in ALLDIRS:
  site.addsitedir(directory)

# Reorder sys.path so new directories at the front.
new_sys_path = [] 
for item in list(sys.path): 
    if item not in prev_sys_path: 
        new_sys_path.append(item) 
        sys.path.remove(item) 
sys.path[:0] = new_sys_path 

import os
import sys
import django


print >>sys.stderr , "My Review App running"

home_dir=os.getenv("HOME")
print >> sys.stderr , home_dir
if home_dir=='/home/amit' or home_dir==None:
    sys.path.append('/home/amit/SEES-hacks/SEESenv/web')
    sys.path.append('/home/amit/SEES-hacks/SEESenv/web/hgbook/comments')
else:
    sys.path.append('/home/hg/repos/SEES-hacks/SEESenv/web')
    sys.path.append('/home/hg/repos/SEES-hacks/SEESenv/web/hgbook/comments')
print >> sys.stderr , sys.path
os.environ['DJANGO_SETTINGS_MODULE'] = 'hgbook.settings'

import django.core.handlers.wsgi

print >> sys.stderr , django.core.handlers.wsgi.WSGIRequest.GET
application = django.core.handlers.wsgi.WSGIHandler()
print >> sys.stderr , django.core.handlers.wsgi.WSGIRequest.GET
_application = django.core.handlers.wsgi.WSGIHandler()
#print >> sys.stderr , django.core.handlers.wsgi.WSGIRequest.GET    
def application(environ, start_response):
    print >> sys.stderr ,environ['PATH_INFO']
    
    return _application(environ, start_response)