驺吾其形似虎,身具五彩斑纹,尾长过身,骑乘可日行千里,且不食活物。集成FastAPI、SQLModel 实现标准CRUD 操作API
Project description
Misty.zouwu (驺吾)
由 Misty(迷雾工作室) 开发的驺吾平台搭建的一套基于FastAPI 的快速搭建的包。
架构
API:FastAPI
Auth: JWT
ORM: SQLModel
DB: Mysql
依赖包清单
asgi_correlation_id==4.3.4
asgiref==3.11.1
cryptography==46.0.5
fastapi==0.135.1
httpx==0.28.1
itsdangerous==2.2.0
loguru==0.7.3
msgspec==0.20.0
passlib==1.7.4
pydantic==2.12.5
pydantic_core==2.42.0
pydantic_settings==2.13.1
python-dotenv==1.2.2
setuptools==82.0.0
setuptools==80.10.2
SQLAlchemy==2.0.47
sqlmodel==0.0.37
starlette==0.52.1
user_agents==2.2.0
uvicorn==0.41.0
xdbsearchip==1.0.2
配置文件(.env):
#系统配置
SYS_DEBUG = False
SYS_APP_ENV = 'dev'
# 时区和时间格式
SYS_DATETIME_TIMEZONE= 'Asia/Shanghai'
SYS_DATETIME_FORMAT= "%Y-%m-%d %H:%M:%S"
# Profiling
SYS_SLOW_REQUEST_THRESHOLD = 0.1 # 慢请求阈值(秒)
SYS_MEMORY_WARNING_THRESHOLD: = 100 * 1024 * 1024 # 内存警告阈值(字节)
#API配置
API_DEBUG = False
API_PROJECT_NAME = "驺吾API"
API_PROJECT_VERSION = "2.1.0.0302"
API_DESCRIPTION = "由 Misty(迷雾工作室) 开发的驺吾平台搭建的一套ERP管理系统后台服务"
API_PATH = '/api'
# API 地址
API_HOST = '0.0.0.0'
API_PORT = 9900
# Middleware
MIDDLEWARE_CORS = True
MIDDLEWARE_ACCESS = True
# CORS
CORS_ALLOWED_ORIGINS = ['http://localhost:5173','*']
# 加密密钥
# Env Opera Log # 密钥 os.urandom(32), 需使用 bytes.hex(os.urandom(32)) 方法转换为 str
OPERA_LOG_ENCRYPT_SECRET_KEY = 'Misty.zouwu@key'
# Token
TOKEN_SECRET_KEY = '密钥'
TOKEN_ALGORITHM = 'HS256' # 算法
TOKEN_EXPIRE_SECONDS = 60 * 60 * 24 * 1 # 过期时间,单位:秒
TOKEN_REFRESH_EXPIRE_SECONDS = 60 * 60 * 24 * 7 # refresh token 过期时间,单位:秒
LOG_STDOUT_FILENAME = 'misty_code_access.log'
LOG_STDERR_FILENAME = 'misty_code_error.log'
#数据库配置
DB_DEBUG=False
DB_TYPE='MySql'
DB_HOST='localhost'
DB_PORT=13306
DB_DATABASE='zouwu'
DB_USERNAME='misty_zuowu'
DB_PASSWORD='misty.zouwu'
Demo(main.py)
from dotenv import load_dotenv
load_dotenv()
from apis.api_register import register_app, start_app
if __name__ == '__main__':
routers = []
app = register_app(routers)
start_app(app)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
misty_zouwu-0.2.4.tar.gz
(41.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file misty_zouwu-0.2.4.tar.gz.
File metadata
- Download URL: misty_zouwu-0.2.4.tar.gz
- Upload date:
- Size: 41.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c7fc27532fa7584e614caefb5f7d716e131c3823675d417cf74a46282cfbb4b4
|
|
| MD5 |
d35e00a5fe9bff0a0c8c5c8fe14f2d2d
|
|
| BLAKE2b-256 |
884fc08848050b6ab2bdce31310a85143aac478d63b7b884f4652dde10514b5c
|
File details
Details for the file misty_zouwu-0.2.4-py3-none-any.whl.
File metadata
- Download URL: misty_zouwu-0.2.4-py3-none-any.whl
- Upload date:
- Size: 51.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f761cc8b68dfd8aead8afeea619f484e7e41bb388c98856174b2236b8fd466bb
|
|
| MD5 |
4c42aa8a05003055fe68d9d2acce95c5
|
|
| BLAKE2b-256 |
43f82bc0c3bd968e625e3ca76fe9e7d990399364d560d0a7f3f576636cedcaba
|