Wsgi: Use python-home option instead of env var

This commit is contained in:
0livd 2017-04-03 13:04:22 +02:00
parent e6f2a1c008
commit 7c56f5f44f
2 changed files with 6 additions and 12 deletions

View file

@ -1,9 +1,8 @@
<VirtualHost *:80>
# 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

View file

@ -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)
from run import app as application