fastapi的构建cms,推荐fastapi集成框架 s3rius/FastAPI-template
在使用fastapi开发通用cms平台的时候,官方给的模板是 https://fastapi.tiangolo.com/zh/project-generation/
对应的仓库是: https://github.com/fastapi/full-stack-fastapi-template
但是这个是对应数据库是pgsql,尝试改造之后发现还是有问题
突然看到这个项目
https://github.com/s3rius/FastAPI-template
把可以把很多组件全部集成在项目里

注意:先安装uv
本地测试环境 是py版本 3.14.3 windows 11
You can install it directly from pypi with pip.
python -m pip install fastapi_template
python -m fastapi_template
cd new_project
docker-compose up --build
如果你想从源代码安装,可以尝试以下步骤:
python -m pip install uv
python -m pip install .
python -m fastapi_template
此外,你还可以将它与Docker一起使用。
docker run --rm -it -v "$(pwd):/projects" ghcr.io/s3rius/fastapi_template
注意:
先不要选 fastapi-users support ,这个选了生成可能会报错
gunicorn server 也不要选,如果你只是体验和先开发测试框架,就也先不选,因为这个组件只能在linux里使用
不选就可以直接在windows上跑
如果你想使用 gunicorn server 就建议在docker上跑
D:\python_code\app\app\web\api\router.py
api_router = APIRouter()
api_router.include_router(monitoring.router)
api_router.include_router(docs.router)
api_router.include_router(echo.router, prefix="/echo", tags=["echo"])
api_router.include_router(dummy.router, prefix="/dummy", tags=["dummy"])
api_router.include_router(redis.router, prefix="/redis", tags=["redis"])
http://127.0.0.1:8000/api/docs swagger地址
默认地址是:http://127.0.0.1:8000/api 自带api
配置文件在 D:\python_code\app\app\settings.py 也会读取.env文件
主要操作流程





QQ一群 247823727
QQ二群 166427999
如果项目有技术瓶颈问题,请联系↓↓
QQ: 903464207
微信: zx903464207
QQ二群 166427999
如果项目有技术瓶颈问题,请联系↓↓
QQ: 903464207
微信: zx903464207
浙公网安备 33010602011771号