diff options
author | Aamir Khan <syst3m.w0rm@gmail.com> | 2012-07-07 17:33:54 -0400 |
---|---|---|
committer | Aamir Khan <syst3m.w0rm@gmail.com> | 2012-07-07 17:33:54 -0400 |
commit | f46b77083bfd2543b39e77df68eaeff06799aef8 (patch) | |
tree | 1adef72197a3456094f6829b3f7b2b2b109a34dc /apache/django.wsgi | |
parent | 5f0e0a0ca25770784c47f1036bf972bd29a14789 (diff) | |
download | hyperkitty-f46b77083bfd2543b39e77df68eaeff06799aef8.tar.gz hyperkitty-f46b77083bfd2543b39e77df68eaeff06799aef8.tar.xz hyperkitty-f46b77083bfd2543b39e77df68eaeff06799aef8.zip |
production server deployment using apache wsgi module
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() |