Wu Clan 6c5e7a6881 Add department-related interfaces and others (#101)
* Add tool to build tree structure data

* Update to keyword parameter style

* Add department-related interfaces

* Update departmental section interface permissions

* Add TODO and minor fixes

* Fix department relationships

* Fix user foreign key relationship deletion setting

* Add path parameters to the operation log

* Complete todo items

* Update department deletion logic

* Update operation log entry records

* Add AES encryption algorithm

* Add operation log request entry to the secret

* Fix naming prefixes

* Add easy encryption tools

* FIX CASBIN_EXCLUDE typing

* Update user password reset interface

* Add confirm_password to the operation log encryption
2023-06-09 11:00:13 +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%