The error from apache after a 504 page
[info] mod_wsgi (pid=): Python home /var/venv/mybox.
[info] mod_wsgi (pid=): Initializing Python.
ImportError: No mod
My whole server uses Python 2.7, but I've already installed Python 3.6 and my virtualenv is using Python 3.6.
After configured djang.conf (/etc/httpd/conf.d/django.conf) with this code:
WSGIDaemonProcess myProj python-home=/home/user/django-site/env python-path=/home/user/django-site
WSGIProcessGroup myProj
WSGIScriptAlias /myProj /home/user/django-site/my-project/wsgi.py
Alias /static /home/user/django-site/static
Require all granted
Require all granted
And restarted my apache
sudo systemctl restart httpd
I got this error a thousand lines (/var/log/httpd/error_log)
ImportError: No module named site
ImportError: No module named site
ImportError: No module named site
ImportError: No module named site
First:
sudo grep wsgi /var/log/httpd/error_log
I got this:
[mpm_prefork:notice] [pid 62324] AH00163: Apache/2.4.6 (CentOS) PHP/7.0.33 mod_wsgi/3.4 Python/2.7.5 configured -- resuming normal operations
Note the Python version (2.7.5). What I did to get mod_wsgi according to my Python 3.6 is using:
yum list *mod_wsgi*
Installed packages
mod_wsgi.x86_64 3.4-18.el7 @base
Disponible packages
python35u-mod_wsgi.x86_64 4.6.2-1.ius.centos7 ius
python36u-mod_wsgi.x86_64 4.6.2-1.ius.centos7 ius
and then I installed the package python36u-mod_wsgi.x86_64:
sudo yum install python36u-mod_wsgi.x86_64
Then I restarted Apache service:
sudo systemctl restart httpd
And got this new line from logs:
[Fri Mar 29 12:33:26.788716 2019] [mpm_prefork:notice] [pid 76317] AH00163: Apache/2.4.6 (CentOS) PHP/7.0.33 mod_wsgi/4.6.2 Python/3.6 configured -- resuming normal operations