Wu Clan 4e4c6fbe95 add login logs (#76)
* simplify crud method naming

* update get_user_list to get_select

* add sign in logs

* Perform pre-commit fix

* Encapsulated request ip address resolution

* Delete login log records for uncertain exceptions

* Add login log deletion interface

* Add login logging to background tasks

* update the user agent parse
2023-05-27 22:55:25 +08:00
2023-05-27 22:55:25 +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
2023-05-23 17:52:34 +08:00
2023-05-23 17:52:34 +08:00
2023-05-27 22:55:25 +08:00
2023-04-19 11:05:49 +08:00

FastAPI Best Architecture

English | 简体中文

This is a base project of the FastAPI framework, 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
  • 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 and view backend/app/core/conf.py, update database configuration information

  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. Run the one-click start command in the directory where the docker-compose.yml file is located

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

  3. 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%