langbrain/Python FastAPI.md

762 B

Set up virtual environnement

At the root of your repository, first set up a python virtual environnement.

$ python -m venv .venv

This will be useful to keep track of the dependencies

source

Activate it $ source .venv/bin/activate

now you should see (.venv) ~/Code/fastapi-corbia-telegram$

pip install --upgrade pip

(.venv) ~/Code/fastapi-corbia-telegram$ pip install fastapi[all] uvicorn

To save the dependency list, you can run the pip freeze command and send the output to a requirement.txt

(.venv) ~/Code/fastapi-corbia-telegram$ pip freeze > requirements.txt

Later on, when you deploy your application on a server, you will be able to run

(.venv) pip install -r requirements.txt