<<<<<<< HEAD
FastApiModuleTemplate
1.简介
FastApi 模块工程模板。
2.使用说明
本仓库 FastApiModuleTemplate 是 FastApi 应用 的 子模块工程模板。 该工程可以 独立开发,独立运行,并在必要时,可以由 FastApi 应用 引用集成。
2.1.工程目录
.
├── FastApiModuleTemplate # 子模块名
│ ├── dependencies # 依赖项模块
│ │ ├── __init__.py
│ │ ├── authorization.py # 授权依赖
│ ├── docs # 相关文档与手册
│ │ ├── manual.md # 手册文档
│ ├── items # 数据结构模块
│ │ ├── __init__.py
│ │ ├── user_item.py # 用户数据结构
│ ├── logs # 日志文件
│ │ ├── .gitkeep
│ ├── models # 数据库 ORM 模块
│ │ ├── __init__.py
│ ├── routers # 路由模块
│ │ ├── __init__.py
│ │ ├── swagger_router.py # swagger 子路由,请勿删除
│ │ ├── hello_world_router.py # hello_world 子路由
│ ├── services # 服务逻辑模块
│ │ ├── __init__.py
│ ├── settings # 配置模块
│ │ ├── __init__.py
│ │ ├── directory_config.py # 目录配置
│ ├── statics # 静态资源文件
│ │ ├── icons # 图标
│ │ │ ├── favicon.svg # favicon 图标
│ ├── templates # HTML 模板文件
│ │ ├── .gitkeep
│ ├── temps # 缓存目录
│ │ ├── .gitkeep
│ └── utils # 第三方、工具、常量、异常等公用工具模块
│ │ ├── __init__.py
│ │ └── log_util.py # 日志工具
│ ├── __init__.py
│ ├── .gitignore
│ ├── app.py # 启动项目入口文件
│ ├── LICENSE # 共享许可证
│ ├── README.md # 项目说明文档
│ ├── requirements.txt # 项目运行环境依赖包
│ ├── restart.sh # 重启脚本
│ ├── start.sh # 启动脚本
│ ├── stop.sh # 停止脚本
2.2.启动步骤
from fastapi import APIRouter
router = APIRouter()
@router.get("/")
async def do_hello_world():
return "Hello World!"
from .routers import hello_world_router
app.include_router(hello_world_router.router)
uvicorn FastApiModuleTemplate.app:app --host 0.0.0.0 --port 8080 --reload
3.注意事项
参考文档
https://github.com/swagger-api/swagger-ui
https://cdn.jsdelivr.net/npm/swagger-ui-dist@5/swagger-ui.css
https://cdn.jsdelivr.net/npm/swagger-ui-dist@5/swagger-ui-bundle.js
f2de3d5ead524c4a16a39f5ed6dbf7dca186cff7
<<<<<<< HEAD
FastApiModuleTemplate
1.简介
FastApi 模块工程模板。
2.使用说明
本仓库 FastApiModuleTemplate 是 FastApi 应用 的 子模块工程模板。 该工程可以 独立开发,独立运行,并在必要时,可以由 FastApi 应用 引用集成。
2.1.工程目录
2.2.启动步骤
3.注意事项
在 Python 开发 时,请使用 相对引用。
FastApi 使用 APIRouter 子路由构建路径
参考文档
官方文档
swagger
Comment_Information_Collection