Python version - 3.12.3
- Spin up a virtual environment in
/backend/
. We're usingvirtualenv
.
Warning
Instructions below assume that your working directory is /backend/
virtualenv venv
source venv/bin/activate
- Install dependencies
pip3 install -r requirements.txt
Installing dependencies using the requirements file has not worked well for
me so far. So, if it fails, install each dependency one by one. Some
dependencies require more than a simple pip
install.
- fastapi
pip
install command is different. Refer the FastAPI docs.
pip install "fastapi[standard]"
- psycopg2
python3-devel
, libpg-devel
libraries are required. The exat names of the
libraries depend on the OS or the Linux distribution. Look it up!
- pyjwt
- bcrypt
pip
install command is different. Refer the FastAPI authorization docs.
pip install "passlib[bcrypt]"
-
Setup PostgreSQL database
- Initiate Postgresql.
- Add password to default user (postgres).
- Create new user with password (admin of the pindrop database).
- Alter newly created user with appropriate privileges (user roles).
- Change the authentication mode form
peer
tomd5
. - Login to the database as the new user.
- Create database for pindrop.
- Create a user to be used by the api.
- Grant relevant privileges to the newly created user.
-
Fill in the values of config files
Sample config files are given. Copy them and fill in the values.
- .env.sample
- database/database.ini
- Run the backend application using fastapi cli
fastapi dev app/main.py
Happy coding!