LAMP Stack (Python + Flask)
Instructions
Install python wsgi apache module.
sudo apt-get install libapache2-mod-wsgi-py3 python-dev
Install flask.
pip3.6 install flask
Verify Apache is running.
apache2 -f /etc/apache2/apache2.conf -k start
Create wsgi file with same name as python applicaton.
Create Apache config file for flask application.
Enable site from file with a2ensite.
Restart Apache2.
Related articles
Reference:
https://flask.palletsprojects.com/en/1.1.x/deploying/mod_wsgi/
https://github.com/GrahamDumpleton/mod_wsgi
https://www.codementor.io/@abhishake/minimal-apache-configuration-for-deploying-a-flask-app-ubuntu-18-04-phu50a7ft
https://modwsgi.readthedocs.io/en/develop/user-guides/configuration-guidelines.html
https://stackoverflow.com/questions/22711087/flask-importerror-no-module-named-app
https://stackoverflow.com/questions/31252791/flask-importerror-no-module-named-flask
https://stackoverflow.com/questions/338768/python-error-importerror-no-module-named