Add support for a $sitedir/venv directory and activate it when found.
Review Request #13056 — Created May 19, 2023 and submitted
As part of an effort to move toward encouraging virtualenv-based
management of Review Board installs, this change updates our WSGI
entrypoint and our auto-generated configurations to detect and
sanity-check a virtualenv setup and activate it if available.
reviewboard/wsgi.py
now looks to see if we have a$sitedir/venv
directory. If it exists, and we're not already in a virtualenv, it will
make sure the right files are present and then activate it. If anything
is missing, aRuntimeError
will be raised with instructions, helping
admins sort out the issue.Validation checks for the presence of an
activate_this.py
(which is
created byvirtualenv
but notpython -m venv
) and apythonX.Y
binary matching the currently-executing Python version.Environment variables are built from the new state, ensuring
subprocesses will see the correct versions of binaries and packages.This also adds a
$sitedir/bin
to$PATH
, giving us a place to put
executables likep4
without placing them in system directories.
Tested with both a global Python and a virtualenv-backed install.
Verified that thevenv
directory was present for a virtualenv-backed
install, and that its environment was properly used in a default Apache,
uWSGI, and Gunicorn setup.Tested pruning some of the virtualenv dir to hit the WSGI error checks.
Verified the resulting errors.
Summary | ID |
---|---|
8e4f7a5ca4bf3e4ef389af98d7c6ffcf578c3625 |
Description | From | Last Updated |
---|---|---|
Instead of "recreate" I think we should explicitly say they should delete the old one and create a new one … |
david |