How to get mod_wsgi to pick up my virtualenv
I was having the same issue, the solution is actually quite simple. You need to install libapache2-mod-wsgi-py3
instead of libapache2-mod-wsgi
. The latter is for python 2.
You can then activate your environment by adding the environment's site-packages to the system path. For example, for me (using venv) I can do this by adding the following line to my *.wgsi
file.
sys.path.insert(0,"/path/to/venv/lib/python3.8/site-packages")
If you are using mod_wsgi, read the documentation at: