How to integrate Flask with apache (Python 3)
Instructions
- Create a folder in /var/www/ name this folder flask_app
- Copy server.py and app.wsgi (from this repository) to that folder
- Go to your desktop (any directory not requiring root permissions may work), create a virtual environment using this command
python3 -m venv venv
- Activate the virtual environment
source venv/bin/activate
- Install Flask
pip install Flask
- Move this folder to the apache folder
sudo cp -r venv /var/www/flask_app
- Now lets set up the apache configuration
- Move flask.conf to sites-available
sudo cp flask.conf /etc/apache2/sites-available/
- Enable configuration
sudo a2ensite flask.conf
- Restart Apache
sudo service apache2 restart