Wu Clan d292768432 Fix offline parse ip info (#112)
* Fix get info subscript

* Fix return typing
2023-06-11 12:49:46 +08:00
2023-05-11 15:20:57 +08:00
2023-05-23 19:14:11 +08:00
2023-04-19 11:05:49 +08:00
2023-04-24 13:44:32 +08:00

FastAPI Best Architecture

English | 简体中文

This is a basic project of the FastAPI framework, using a pseudo three-tier architecture, still in production

Its purpose is to allow you to develop your project directly with it as your base project

Support python3.10 and above

Skill

  • FastAPI
  • Pydantic
  • SQLAlchemy
  • Alembic
  • Casbin
  • MySQL
  • Redis
  • APScheduler
  • Docker

Clone

git clone https://github.com/wu-clan/fastapi_best_architecture.git

Use:

1Tradition

  1. Install dependencies

    pip install -r requirements.txt
    
  2. Create a database fba, choose utf8mb4 encode

  3. Install and start Redis

  4. create a .env file in the backend/app/ directory

    cd backend/app/
    
    touch .env
    
  5. Copy .env.example to .env

    cp .env.example .env
    
  6. Perform a database migration alembic

    cd backend/app/
    
    # Generate the migration file
    alembic revision --autogenerate
    
    # Perform the migration
    alembic upgrade head
    
  7. Execute the backend/app/main.py file startup service

  8. Browser access: http://127.0.0.1:8000/v1/docs


2Docker

  1. Go to the directory where the docker-compose.yml file is located and create the environment variable file .env

    cp .env.server ../../backend/app/.env   
    
    # This command is optional
    cp .env.docker .env
    
  2. Execute the one-click start command

    docker-compose up -d -build
    
  3. Wait for the command to finish automatically

  4. Browser access: http://127.0.0.1:8000/v1/docs

Init the test data

Execute the backend/app/init_test_data.py file

Test

Perform tests via pytest

  1. Create a database fba_test, choose utf8mb4 encode

  2. First, go to the app directory

    cd backend/app/
    
  3. Init the test data

    python tests/init_test_data.py
    
  4. Execute the test command

    pytest -vs --disable-warnings
    
S
Description
企业级后端架构解决方案
Readme MIT
27 MiB
Languages
Python 96.5%
Jinja 2.7%
HTML 0.4%
Dockerfile 0.3%