sudo apt-get install libapache2-mod-wsgi -y
- Put Python script in the directory you want it in
sudo chown www-data:www-data /var/www/html/captureform.py
sudo chmod 755 /var/www/html/captureform.py
- Configure the wsgi Apache mod, place the below
wsgi.conf
file in/etc/apache2/conf-available/wsgi.conf
sudo a2enconf wsgi
sudo systemctl restart apache2
- Point the form that submits creds to the URL that's defined as the WSGI Alias (in this case
/login
, you can change that in thewsgi.conf
file
- All output/errors from scripts ran with
mod_wsgi
will be logged to /var/log/apache2/error.log - As of the time of writing, Python 2.7 will be used by
mod_wsgi
. If you want it to use Python 3.7 you're going to have to follow the intructions here to recompilemod_wsgi
.