Appearance
该项目用于快速创建FastAPI项目,项目中已经集成了数据库迁移工具,可以快速创建数据库模型,同时也集成了数据库迁移工具,可以快速创建数据库迁移文件,方便项目开发。 删除.gitignore中的migrations/models/*
目前主要功能已经完备,其他相关通用功能还在完善中,期待各位同事对该模板的添砖加瓦。
注:目前项目用户为.env配置形式,用户模块应按需进行编写
用户认证鉴权建议采用依赖注入形式编写,参考如下
python
from fastapi import Depends
from project.server import app_router
from common.user_valid import User, get_current_user
@app_router.get("/")
async def index(user: User = Depends(get_current_user)):
print(user)
return {"message": "Hello World"}