Support specifying virtualenv path with or without activate_this.py

The docs specified that the wsgi scripts expected an absolute path to
a virtualenv yet what we really wanted was the activate_this.py path.

Change this to support specifying the virtualenv path without
activate_this.py which is more convenient.

Change-Id: I110586dcc7b70a59c212695d1967169f7de0a232
This commit is contained in:
David Moreau Simard 2018-05-09 12:24:43 -04:00
parent 3a200f881c
commit 513382dd77
2 changed files with 8 additions and 0 deletions

View File

@ -36,7 +36,11 @@ import six
if (int(os.getenv('ARA_WSGI_USE_VIRTUALENV', 0)) == 1 and
os.getenv('ARA_WSGI_VIRTUALENV_PATH')):
# Backwards compatibility, we did not always suffix activate_this.py
activate_this = os.getenv('ARA_WSGI_VIRTUALENV_PATH')
if 'activate_this.py' not in activate_this:
activate_this = os.path.join(activate_this, 'bin/activate_this.py')
if six.PY2:
execfile(activate_this, dict(__file__=activate_this)) # nosec
else:

View File

@ -53,7 +53,11 @@ import time
if (int(os.getenv('ARA_WSGI_USE_VIRTUALENV', 0)) == 1 and
os.getenv('ARA_WSGI_VIRTUALENV_PATH')):
# Backwards compatibility, we did not always suffix activate_this.py
activate_this = os.getenv('ARA_WSGI_VIRTUALENV_PATH')
if 'activate_this.py' not in activate_this:
activate_this = os.path.join(activate_this, 'bin/activate_this.py')
if six.PY2:
execfile(activate_this, dict(__file__=activate_this)) # nosec
else: