Small flask server
Go to file
2024-10-13 17:22:17 +02:00
kinolist Merge branch 'main' of lain.church:bartholin/flask-server 2024-10-13 10:59:59 +02:00
.gitignore changes for docker compose 2024-10-13 10:58:48 +02:00
docker-compose.yml added security 2024-10-13 17:22:17 +02:00
docker-entrypoint.sh changes for docker compose 2024-10-13 10:58:48 +02:00
Dockerfile changes for docker compose 2024-10-13 10:58:48 +02:00
env.example first commit (create a local server) 2024-10-08 19:26:26 +02:00
LICENSE.md add license GPL v3+ 2024-10-10 23:44:47 +02:00
README.md changes for docker compose 2024-10-13 10:58:48 +02:00
requirements.txt changes for docker compose 2024-10-13 10:58:48 +02:00

Things you'll have to do once to initialize the project

Do the following in order:

Create an .env file

cp env.example .env

Then edit the .env file to enter a flask secret key, your omdb key and an administrator password for the site.

Initialize the environment

There is a configure.sh file:

sh configure.sh

You can also initialize the environment yourself:

Create a virtual environment

Create an env folder:

python -m venv env

To enter the (env) environment:

source env/bin/activate

The keyword (env) should appear in the beginning of the prompt. If you want to quit the virtual environment, do deactivate. If you are not in the virtual environment (the (env) keyword does not appear in the prompt), do source env/bin/activate again to go back to the environment.

Install the required python packages

python -m pip install -r requirements.txt

Initialize the database

Warning! This will erase the database. Pro-tip: this will erase the database.

python -m flask --app kinolist init-db

Things to do whenever you want to launch the project locally

Enter the local environment

source env/bin/activate

The keyword (env) should appear in the beginning of the prompt. If you want to quit the virtual environment, do deactivate. If you are not in the virtual environment (the (env) keyword does not appear in the prompt), do source env/bin/activate again to go back to the environment.

Launch the Flask server

python -m flask --app kinolist run --port 8000 --debug

You can access the site at the adress localhost:8000 on your web browser. Do Ctrl+C to stop the server.