驺吾其形似虎,身具五彩斑纹,尾长过身,骑乘可日行千里,且不食活物。集成FastAPI、SQLModel 实现标准CRUD 操作API
Project description
架构: API:FastAPI Auth:JWT 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'
使用方法: 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
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.3.tar.gz.
File metadata
- Download URL: misty_zouwu-0.2.3.tar.gz
- Upload date:
- Size: 41.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
37630ab9584f79b8d81331b4e945573eadb9adb4c6d39962cfae030dc5f6cf9d
|
|
| MD5 |
414611c8acca867475d025ce5a69f67d
|
|
| BLAKE2b-256 |
299a3df9ab0fc17affda937937d9f423e9836ad708243c986099073822d73aee
|
File details
Details for the file misty_zouwu-0.2.3-py3-none-any.whl.
File metadata
- Download URL: misty_zouwu-0.2.3-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 |
60914efe4f2f5ff06efcce46c5ab2372b4ec9428ab42344a2252aa91e0d7329b
|
|
| MD5 |
08f0e14dd763bd61edcd57eff0ec2448
|
|
| BLAKE2b-256 |
fa2d2e0d1b77af2e467fe14297c15816d24ee892bfefc9846a2e991a1a91435b
|