A REST API client for the COVID-19 Dasoboard
Run the following command to generate a secret key first:
openssl rand -hex 32
Then add the followings to your .env
file:
SECRET_KEY=<SECRET_KEY>
ALGORITHM="HS256"
ACCESS_TOKEN_EXPIRE_DAYS=<TOKEN_LIFETIME_IN_DAYS>
virtualenv venv
source venv/bin/activate
pip install -r requirements.txt
The app relies on Firestore on Google Cloud Platform (GCP). Create a project on GCP and initialise your Firestore database in native mode. Make sure you also initialise gcloud cli with gcloud init
.
Obtain a hashed password with the following python code:
from passlib.context import CryptContext
pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
password="your_password"
print(pwd_context.hash(password))
Finally on Firestore, create a users
collection and add a document with the followng fields:
{
"username": "username",
"hashed_password": "hashed_password",
"disabled": false
}
uvicorn app.main:app --reload
Go to http://127.0.0.1:8000/docs
for Swagger docs or http://127.0.0.1:8000/redoc
for ReDoc