https://github.com/thesparkvision/fastapi-basic-project
I am learning FastAPI. This Repository contains a basic project which deals with some simple data and interact with MongoDB for accessing/updating it
https://github.com/thesparkvision/fastapi-basic-project
fastapi
Last synced: about 1 month ago
JSON representation
I am learning FastAPI. This Repository contains a basic project which deals with some simple data and interact with MongoDB for accessing/updating it
- Host: GitHub
- URL: https://github.com/thesparkvision/fastapi-basic-project
- Owner: thesparkvision
- License: apache-2.0
- Created: 2023-07-16T12:35:28.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-07-23T23:13:37.000Z (almost 3 years ago)
- Last Synced: 2025-01-23T17:17:08.000Z (over 1 year ago)
- Topics: fastapi
- Language: Python
- Homepage: https://fastapi-exp.onrender.com/
- Size: 22.5 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/thesparkvision/FastAPI/actions/workflows/build_and_run.yaml)
## Intro
This repository is to practice FastAPI code while learning it
## Live App Link
https://fastapi-learning.onrender.com/
## Setup
**Python Version**: 3.11.1
- Create Virtual env
```shell
python3 -m venv venv
```
- Install Packages
```shell
pip install -r requirements.txt
```
- Add these environment variables in .env file or in shell
```
export MONGO_URI=mongodb://172.17.0.2:27017
export PYTHONPATH=$PYTHONPATH:$PWD
export APP_HOST=0.0.0.0
export APP_PORT=8000
```
- Install MongoDB or use MongoDB Docker Image (https://hub.docker.com/_/mongo)
## Run the app directly in local environment inside src folder
```shell
python3 main.py
```
## Local Docker Container Setup
If you prefer to use docker container,
or need to debug the build for some reason,
you can follow these chain of commands:
- Build the Docker Image
```shell
docker build . -t fastapi-learning:v1 -f deploy/Dockerfile
```
- Create and Run Docker container
```shell
docker run -d --net=host fastapi-learning:v1
```
## Run Lint
```shell
bash scripts/lint.sh
```