mod_wsgi not using venv

Viewed 62

I am trying to setup a Django project using Apache with mod_wsgi. I have set wsgi like this:

WSGIDaemonProcess Breath python-home=/var/www/vhosts/Breath/env/
WSGIProcessGroup Breath
WSGIScriptAlias / /var/www/vhosts/Breath/BreathAlessio/wsgi.py process-group=Breath

So I'd like to launch the wsgi.py with the version in the venv, but by checking the version I see it runs it with the default python installation.

I get this error on apache error log because it uses the wrong version.

[Thu Apr 07 12:57:09.681861 2022] [wsgi:error] [pid 60865:tid 139865656153856] [remote 131.114.215.254:45334] Traceback (most recent call last):
[Thu Apr 07 12:57:09.681898 2022] [wsgi:error] [pid 60865:tid 139865656153856] [remote 131.114.215.254:45334]   File "/var/www/vhosts/Breath/BreathAlessio/wsgi.py", line 12, in <module>
[Thu Apr 07 12:57:09.681905 2022] [wsgi:error] [pid 60865:tid 139865656153856] [remote 131.114.215.254:45334]     from django.core.wsgi import get_wsgi_application
[Thu Apr 07 12:57:09.681950 2022] [wsgi:error] [pid 60865:tid 139865656153856] [remote 131.114.215.254:45334] ModuleNotFoundError: No module named 'django'

What am I doing wrong? I have tried to set all the permission to 777 and to change the owner of the project but nothing changed.

1 Answers
Related