SEESenv/web/hgbook/run.wsgi
author amit@thunder
Thu, 04 Mar 2010 14:33:38 +0530
changeset 43 134b87b382f5
parent 22 a27f1e69d966
permissions -rwxr-xr-x
Made changes so that the files so that files above chapter 10 do not come twice also changed the name so that any chapter beyond 9 is listed in the end
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6
1ce9b33fb6ff sorted the problem related to paths
amit@thunder
parents: 3
diff changeset
     1
import os
1ce9b33fb6ff sorted the problem related to paths
amit@thunder
parents: 3
diff changeset
     2
home_dir=os.getenv("HOME")
1ce9b33fb6ff sorted the problem related to paths
amit@thunder
parents: 3
diff changeset
     3
if home_dir=='/home/amit':
1ce9b33fb6ff sorted the problem related to paths
amit@thunder
parents: 3
diff changeset
     4
    ALLDIRS = ['/home/amit/SEES-hacks/SEESenv/lib/python2.6/site-packages']
1ce9b33fb6ff sorted the problem related to paths
amit@thunder
parents: 3
diff changeset
     5
else:
1ce9b33fb6ff sorted the problem related to paths
amit@thunder
parents: 3
diff changeset
     6
    ALLDIRS = ['/home/hg/repos/SEES-hacks/SEESenv/lib/python2.6/site-packages']
3
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents: 2
diff changeset
     7
import sys 
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents: 2
diff changeset
     8
import site 
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents: 2
diff changeset
     9
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents: 2
diff changeset
    10
# Remember original sys.path.
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents: 2
diff changeset
    11
prev_sys_path = list(sys.path) 
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents: 2
diff changeset
    12
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents: 2
diff changeset
    13
# Add each new site-packages directory.
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents: 2
diff changeset
    14
for directory in ALLDIRS:
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents: 2
diff changeset
    15
  site.addsitedir(directory)
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents: 2
diff changeset
    16
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents: 2
diff changeset
    17
# Reorder sys.path so new directories at the front.
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents: 2
diff changeset
    18
new_sys_path = [] 
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents: 2
diff changeset
    19
for item in list(sys.path): 
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents: 2
diff changeset
    20
    if item not in prev_sys_path: 
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents: 2
diff changeset
    21
        new_sys_path.append(item) 
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents: 2
diff changeset
    22
        sys.path.remove(item) 
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents: 2
diff changeset
    23
sys.path[:0] = new_sys_path 
6cee07c589cb Changes in path of some of the files ...
amit@thunder
parents: 2
diff changeset
    24
0
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    25
import os
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    26
import sys
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    27
import django
10
aff1900403ee Testing urls part something there...
amit@thunder
parents: 9
diff changeset
    28
aff1900403ee Testing urls part something there...
amit@thunder
parents: 9
diff changeset
    29
9
ab616eb10878 Testing
amit@thunder
parents: 6
diff changeset
    30
print >>sys.stderr , "My Review App running"
10
aff1900403ee Testing urls part something there...
amit@thunder
parents: 9
diff changeset
    31
6
1ce9b33fb6ff sorted the problem related to paths
amit@thunder
parents: 3
diff changeset
    32
home_dir=os.getenv("HOME")
22
a27f1e69d966 testing .. I am really confused about how to handle the change of repos from /home/amit to /home/hg
amit@thunder
parents: 21
diff changeset
    33
print >> sys.stderr , home_dir
a27f1e69d966 testing .. I am really confused about how to handle the change of repos from /home/amit to /home/hg
amit@thunder
parents: 21
diff changeset
    34
if home_dir=='/home/amit':
20
35027af14f21 Solving problems related to sys.path
amit@thunder
parents: 19
diff changeset
    35
    sys.path.append('/home/amit/SEES-hacks/SEESenv/web')
6
1ce9b33fb6ff sorted the problem related to paths
amit@thunder
parents: 3
diff changeset
    36
    sys.path.append('/home/amit/SEES-hacks/SEESenv/web/hgbook/comments')
1ce9b33fb6ff sorted the problem related to paths
amit@thunder
parents: 3
diff changeset
    37
else:
20
35027af14f21 Solving problems related to sys.path
amit@thunder
parents: 19
diff changeset
    38
    sys.path.append('/home/hg/repos/SEES-hacks/SEESenv/web')
6
1ce9b33fb6ff sorted the problem related to paths
amit@thunder
parents: 3
diff changeset
    39
    sys.path.append('/home/hg/repos/SEES-hacks/SEESenv/web/hgbook/comments')
21
5f66214fce86 Testing
amit@thunder
parents: 20
diff changeset
    40
print >> sys.stderr , sys.path
0
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    41
os.environ['DJANGO_SETTINGS_MODULE'] = 'hgbook.settings'
21
5f66214fce86 Testing
amit@thunder
parents: 20
diff changeset
    42
0
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    43
import django.core.handlers.wsgi
21
5f66214fce86 Testing
amit@thunder
parents: 20
diff changeset
    44
11
a7bd4bca6f6e testing
amit@thunder
parents: 10
diff changeset
    45
print >> sys.stderr , django.core.handlers.wsgi.WSGIRequest.GET
0
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    46
application = django.core.handlers.wsgi.WSGIHandler()
10
aff1900403ee Testing urls part something there...
amit@thunder
parents: 9
diff changeset
    47
print >> sys.stderr , django.core.handlers.wsgi.WSGIRequest.GET
aff1900403ee Testing urls part something there...
amit@thunder
parents: 9
diff changeset
    48
_application = django.core.handlers.wsgi.WSGIHandler()
aff1900403ee Testing urls part something there...
amit@thunder
parents: 9
diff changeset
    49
#print >> sys.stderr , django.core.handlers.wsgi.WSGIRequest.GET    
aff1900403ee Testing urls part something there...
amit@thunder
parents: 9
diff changeset
    50
def application(environ, start_response):
aff1900403ee Testing urls part something there...
amit@thunder
parents: 9
diff changeset
    51
    print >> sys.stderr ,environ['PATH_INFO']
aff1900403ee Testing urls part something there...
amit@thunder
parents: 9
diff changeset
    52
    
aff1900403ee Testing urls part something there...
amit@thunder
parents: 9
diff changeset
    53
    return _application(environ, start_response)
0
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    54
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    55
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    56