Python DevOps course material that I created for the coding club of TSP (Club Code).
Install a virtual environment:
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
Create a gitignore, you can use a plugin of your IDE, download one, or create one by yourself.
curl https://raw.githubusercontent.com/github/gitignore/main/Python.gitignore -o .gitignore
It can simply be achieved with pip:
pip freeze > requirements.txt
⚠️ pyproject.toml has to be updated!
You can use a script to update pyproject.toml:
python update_pyproject.py
The structure can be obtained with tree --gitignore -a --matchdirs -I .git
.
├── .gitignore
├── main.py
└── README.md
Create a token (flask secret key) in .env
at the root of the project:
FLASK_SECRET_KEY=your-secret-key
You can then modify it when calling the script:
python api.py FLASK_SECRET_KEY=my-super-key
Or directly in the environment (Docker, Kubernetes, etc.).