diff --git a/.gitignore b/.gitignore index dbd4cf9..1480f15 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .env *.pyc __pycache__ +.venv venv **/.DS_Store diff --git a/README.md b/README.md new file mode 100644 index 0000000..bc698d7 --- /dev/null +++ b/README.md @@ -0,0 +1,33 @@ +# Sossu flask +This is the sossu's main page. + +## Running +To run this on this server, one should just start the systemd service sossu-flask.service with +the command +```bash +systemctl start sossu-flask.service +``` + +There exists a symlink from `sossunVerkkosivut/sossu-flask.service -> /etc/systemd/system/sossu-flask.service`. +The systemd service file waits for network connectivity before starting and should be enabled by default to run +after system rebooting or on failure. + +If systemd service is not needed the app can be run by +```bash +python wsgi.py +``` + + +## Virtual environment +If one needs to update the `pip` packages or something else to do with such things, there exists a virtual env +at `.venv`. If that does not exist, create it with `python -m venv .venv` + +After that you need to activate it with (in linux at least) +```bash +source .venv/bin/activate +``` + +Then you can install the required packages with +```bash +pip install -r requirements.txt +``` diff --git a/sossu-flask.service b/sossu-flask.service new file mode 100644 index 0000000..263a891 --- /dev/null +++ b/sossu-flask.service @@ -0,0 +1,14 @@ +[Unit] +Description=Python flask app running the sossu main page. + +[Service] +# disables output buffering -> logging works correctly +Environment=PYTHONUNBUFFERED=1 +Restart=on-failure +# checks network connectivity before launching +ExecStartPre=/bin/sh -c 'while ! ping -c1 1.1.1.1 -W.5; do sleep 1; done' +# executes the site +ExecStart=/root/sossunVerkkosivut/.venv/bin/python3 /root/sossunVerkkosivut/wsgi.py + +[Install] +WantedBy=multi-user.target diff --git a/templates/tule_mukaan.html b/templates/tule_mukaan.html index fa6cd96..7e4e187 100644 --- a/templates/tule_mukaan.html +++ b/templates/tule_mukaan.html @@ -28,7 +28,7 @@

Laulamaan mieliville suosittelemme sisaruskuoroamme - Savolaisen osakunnan kuoroa (SOL), + Savolaisen osakunnan kuoroa (SOL), jonka kanssa meillä on pitkät yhteiset keikkailuperinteet.

Miten jäseneksi?

diff --git a/wsgi.py b/wsgi.py index 6026b0f..5b00343 100644 --- a/wsgi.py +++ b/wsgi.py @@ -1,4 +1,4 @@ from app import app if __name__ == "__main__": - app.run() + app.run(host=127.0.0.1, port=5000)