Ejercicio 1: Desplegando aplicaciones flask con Apache + mod_wsgi
En esta tarea se usa la aplicación Guestbook.
Crear venv
mkdir venv
cd venv
sudo apt update
sudo apt install python3-venv
python3 -m venv .
source bin/activate
Descargar Guestbook
sudo apt install git
git clone https://github.com/josedom24/guestbook.git
pip install -r requirements.txt
sudo apt install redis
Probar funcionamiento
Por ahora, usando el servidor de desarrollo:
Fichero wsgi
/home/vagrant/guestbook/app/wsgi.py
Hacer que Apache sirva Guestbook
Creo /etc/apache2/sites-available/guestbook.conf
:
<VirtualHost *:80>
ServerName www.guestbook.com
DocumentRoot /home/vagrant/guestbook/app
<Directory /home/vagrant/guestbook/app>
Require all granted
</Directory>
WSGIDaemonProcess guestbook python-path=/home/vagrant/guestbook/app:/home/vagrant/venv/lib/python3.9/site-packages
WSGIProcessGroup guestbook
WSGIScriptAlias / /home/vagrant/guestbook/app/wsgi.py process-group=guestbook
</VirtualHost>
Lo habilito:
Reinicio Apache:
Modifico mi /etc/hosts
: