This server is built using FastAPI
and interacts with MongoDB
to manage cleaning reports on FLEXA
.
You will first need to create a .env
file to define the environment variables this app will use to run. Following .env.example
:
PORT=<port number>
DEBUG_MODE=<True for development and False for production>
DATABASE_NAME=<name of database>
DATABASE_URL=<mongodb url>
You will also need to install Python
packages listed in Pipfile/requirements.txt
.
Run the following commands to create a virtual environment for this project:
# creates .venv folder in current directory
mkdir .venv
# installs from Pipfile
pipenv install
Without virtual environment:
# installs from requirments.txt
pip install -r requirements.txt
To use the virtual environment (.venv
) created:
# without pipenv shell
pipenv run python app/main.py
OR
# with shell
pipenv shell
python run app/main.py
# to exit pipenv shell
deactivate
Running the app using your global Python
interpreter:
python app/main.py
FastAPI
comes with Swagger UI
to call and test your API directly from the browser. You may access Swagger UI
at http://localhost:8092/docs (this assumes that the app is running on localhost:8092
).