From 7c56f5f44fe31f3be85c553be448f376231d2cc1 Mon Sep 17 00:00:00 2001 From: 0livd <0livd@users.noreply.github.com> Date: Mon, 3 Apr 2017 13:04:22 +0200 Subject: [PATCH] Wsgi: Use python-home option instead of env var --- conf/apache-vhost.conf | 5 ++--- ihatemoney.wsgi | 13 ++++--------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/conf/apache-vhost.conf b/conf/apache-vhost.conf index 53926b3e..4b9dad0a 100644 --- a/conf/apache-vhost.conf +++ b/conf/apache-vhost.conf @@ -1,9 +1,8 @@ - # Uncomment the following line if you use a virtualenv - # SetEnv IHATEMONEY_VENV_PATH /path/to/your/venv ServerAdmin admin@example.com ServerName ihatemoney.example.com - WSGIDaemonProcess ihatemoney user=www-data group=www-data threads=5 + # Uncomment the python-home option if you use a virtualenv + WSGIDaemonProcess ihatemoney user=www-data group=www-data threads=5 # python-home=/path/to/your/venv WSGIScriptAlias / /path/to/ihatemoney/ihatemoney.wsgi ErrorLog /var/log/apache2/ihatemoney.example.com_error.log CustomLog /var/log/apache2/ihatemoney.example.com_access.log combined diff --git a/ihatemoney.wsgi b/ihatemoney.wsgi index 765e2831..fbaa1341 100644 --- a/ihatemoney.wsgi +++ b/ihatemoney.wsgi @@ -3,12 +3,7 @@ import os __HERE__ = os.path.dirname(os.path.abspath(__file__)) -# Wrapper around application to get the env var set by Apache -def application(environ, start_response): - if environ.get('IHATEMONEY_VENV_PATH'): - activate_this = os.path.join(environ.get('IHATEMONEY_VENV_PATH'), 'bin/activate_this.py') - execfile(activate_this, dict(__file__=activate_this)) - # Add the budget directory to the path so we can then import from run - sys.path.insert(0, os.path.join(__HERE__, 'budget')) - from run import app as _application - return _application(environ, start_response) +# Add the budget directory to the path so we can then import from run +sys.path.insert(0, os.path.join(__HERE__, 'budget')) + +from run import app as application