mos_wsgi
Steps to follow:
https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/modwsgi/
Python should be installed as --enabled-shared
Packages installed using pip should be installed with --user option
Install the followings:
httpd for centos (apache2 for debian)
httpd-devel
mod_wsgi
Use mod_wsgi-express module-config command to get the mod_wsgi installation details
Project configuration:
/etc/httpd/conf.d
Add a new file xxxxx.conf
Add the followings:
First two lines are the output from mod_wsgi-express module-config command.
LoadModule wsgi_module "/home/portal/.local/lib/python3.7/site-packages/mod_wsgi/server/mod_wsgi-py37.cpython-37m-x86_64-linux-gnu.so"
WSGIPythonHome "/usr/local"
Alias /static /home/portal/QA_Portal_Deployment/qa_portal/portal/static
<Directory /home/portal/QA_Portal_Deployment/qa_portal/portal/static>
Require all granted
</Directory>
Alias /static/admin/ /home/portal/.local/lib/python3.7/site-packages/django/contrib/admin/static
<Directory /home/portal/.local/lib/python3.7/site-packages/django/contrib/admin/static
Require all granted
</Directory>
<Directory /home/portal/QA_Portal_Deployment/qa_portal/qa_portal>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess qa_portal python-path=/home/portal/QA_Portal_Deployment/qa_portal:/home/portal/.local/lib/python3.7/site-packages
WSGIProcessGroup qa_portal
WSGIScriptAlias / /home/portal/QA_Portal_Deployment/qa_portal/qa_portal/wsgi.py
WSGIPythonPath /usr/local/bin:/home/portal/QA_Portal_Deployment/qa_portal
Apache
Restart httpd service using: systemctl restart httpd
Providing folder permissions to apache:
chmod -R o+rx <project>
chown -R apache:apache <project>
Providing .local folder permission to apache:
chmod -R o+rx ~/.local
chown -R apache:apache ~/.local
Logs:
/var/logs/messages
/etc/httpd/logs/error_log
/etc/httpd/logs/access_log
Environmental Configuration
Set environment variables:
export PYTHONPATH=/usr/local/bin
export LD_LIBRARY_PATH=/usr/local/lib:/opt/oracle/instantclient_19_3:$LD_LIBRARY_PATH