mirror of
https://github.com/fastapi-practices/fastapi_best_architecture.git
synced 2025-08-20 00:03:31 +08:00
FastAPI Best Architecture
This is a base project of the FastAPI framework.
It‘s purpose is to allow you to develop your project directly with it as your base project
Skill
- FastAPI
- Pydantic
- SQLAlchemy
- Alembic
- MySQL
- Redis
- APScheduler
- Docker
Clone
git clone https://github.com/wu-clan/fastapi_best_architecture.git
Use:
1:Tradition
-
Install dependencies
pip install -r requirements.txt
-
Create a database
fba
, choose utf8mb4 encode -
Install and start Redis
-
View
backend/app/core/conf.py
, update database configuration information -
Perform a database migration alembic
cd backend/app/ # Generate the migration file alembic revision --autogenerate # Perform the migration alembic upgrade head
-
Execute the backend/app/main.py file startup service
-
Browser access: http://127.0.0.1:8000/v1/docs
2:Docker
-
Run the one-click start command in the directory where the
docker-compose.yml
file is locateddocker-compose up -d --build
-
Wait for the command to finish automatically
-
Browser access: http://127.0.0.1:8000/v1/docs
Init the test data
Execute the backend/app/init_test_data.py
file
Languages
Python
96.8%
Jinja
2.2%
HTML
0.5%
Dockerfile
0.3%
Shell
0.1%