blob: cc699a4cf65e00446e0c13eb0756de76e8da951f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
import os
import sys
import site
STAGING=True
if STAGING:
# staging virtual environment
vepath = '/home/akhan/.virtualenvs/wackyenv/lib/python2.7/site-packages'
else:
# live virtual environment
vepath = '/home/akhan/.virtualenvs/live-server/lib/python2.7/site-packages'
prev_sys_path = list(sys.path)
# add the site-packages of our virtualenv as a site dir
site.addsitedir(vepath)
# add the app's directory to the PYTHONPATH
sys.path.append('/home/akhan/gsoc')
# reorder sys.path so new directories from the addsitedir show up first
new_sys_path = [p for p in sys.path if p not in prev_sys_path]
for item in new_sys_path:
sys.path.remove(item)
sys.path[:0] = new_sys_path
#Calculate the path based on the location of the WSGI script.
apache_configuration= os.path.dirname(__file__)
project = os.path.dirname(apache_configuration)
workspace = os.path.dirname(project)
sys.path.append(workspace)
os.environ['DJANGO_SETTINGS_MODULE'] = 'gsoc.apache.settings_production'
# make sure this directory is writable by wsgi process
os.environ['PYTHON_EGG_CACHE'] = '/home/akhan/gsoc/.python-egg'
from django.core.handlers.wsgi import WSGIHandler
application = WSGIHandler()
|