diff options
Diffstat (limited to 'apache/django.wsgi')
-rwxr-xr-x | apache/django.wsgi | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/apache/django.wsgi b/apache/django.wsgi new file mode 100755 index 0000000..cc699a4 --- /dev/null +++ b/apache/django.wsgi @@ -0,0 +1,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() |