Small flask server
Go to file
2024-10-10 23:44:47 +02:00
kinolist add license GPL v3+ 2024-10-10 23:44:47 +02:00
.gitignore first commit (create a local server) 2024-10-08 19:26:26 +02:00
configure.sh first commit (create a local server) 2024-10-08 19:26:26 +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 first commit (create a local server) 2024-10-08 19:26:26 +02:00
requirements.txt first commit (create a local server) 2024-10-08 19:26:26 +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.

Remarks

For some reasons, I need a symbolic link from posters/ to kinolist/posters/, I guess it is because python keeps changing the base directory, so the fix I have found is to have two posters folders which are actually the same.