{"id":38575295,"url":"https://github.com/52lu/fast-api-template","last_synced_at":"2026-01-17T08:08:43.017Z","repository":{"id":187435590,"uuid":"676792838","full_name":"52lu/fast-api-template","owner":"52lu","description":"项目是基于FastAPI框架搭建的脚手架模板,方便后续其他新项目可以直接使用，但愿该项目能为想学习、想使用FastApi的开发人员提供帮助。","archived":false,"fork":false,"pushed_at":"2024-05-10T11:34:30.000Z","size":125,"stargazers_count":25,"open_issues_count":1,"forks_count":8,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-05-11T07:33:04.073Z","etag":null,"topics":["fastapi","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/52lu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-10T03:06:11.000Z","updated_at":"2024-05-10T11:34:34.000Z","dependencies_parsed_at":"2024-03-31T16:26:45.833Z","dependency_job_id":"3ebe6708-d370-4f88-8e78-eea007f2a169","html_url":"https://github.com/52lu/fast-api-template","commit_stats":null,"previous_names":["52lu/fast-use-ai","52lu/fast-api-template"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/52lu/fast-api-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/52lu%2Ffast-api-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/52lu%2Ffast-api-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/52lu%2Ffast-api-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/52lu%2Ffast-api-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/52lu","download_url":"https://codeload.github.com/52lu/fast-api-template/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/52lu%2Ffast-api-template/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28504358,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T06:57:29.758Z","status":"ssl_error","status_checked_at":"2026-01-17T06:56:03.931Z","response_time":85,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fastapi","python"],"created_at":"2026-01-17T08:08:42.938Z","updated_at":"2026-01-17T08:08:42.998Z","avatar_url":"https://github.com/52lu.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## fast-api-template\n\n[![Python](https://img.shields.io/badge/Python-3.10+-yellow?style=for-the-badge\u0026logo=python\u0026logoColor=white\u0026labelColor=101010)](https://python.org)\n[![FastAPI](https://img.shields.io/badge/FastAPI-0.110.0-00a393?style=for-the-badge\u0026logo=fastapi\u0026logoColor=white\u0026labelColor=101010)](https://fastapi.tiangolo.com)\n\n### 1.项目介绍\n\n项目是基于[FastAPI](https://fastapi.tiangolo.com/zh/tutorial/first-steps/)\n学习使用FastAPI框架，并搭建一个项目模板,方便后续其他新项目可以直接使用，但愿该项目能为想学习、想使用FastApi的开发人员提供帮助。\n\n\u003e \u003cspan style=\"color: red; \"\u003e@提示:\n\u003e 由于本人工作中常用的语言是PHP和Go，所以框架中的编码规范，并没有严格按照Python官方指定的规范，特别是变量名和函数名~\u003c/span\u003e\n\n- [fastapi中文文档](https://fastapi.tiangolo.com/zh/tutorial/first-steps/)\n\n### 2.目录结构\n\n\u003e \u003cspan style=\"color: red; \"\u003e@注: 下面目录仅供参考，在整个项目未开发结束,会有部分调整。\u003c/span\u003e\n\n```shell\n├── app\n│   ├── __init__.py\n│   ├── config  # 配置相关\n│   │   └── __init__.py\n│   ├── constant  # 常量相关\n│   │   └── __init__.py\n│   ├── dao # 封装查询数据的方法\n│   │   ├── models # 数据模型文件，和表结构对应\n│   │   └── __init__.py\n│   ├── dependencies  # 封装被依赖函数\n│   │   └── __init__.py\n│   ├── errors  # 异常处理\n│   │   └── __init__.py\n│   ├── middleware # 中间件\n│   │   └── __init__.py\n│   ├── router # 路由也可以理解controller\n│   │   ├── __init__.py\n│   │   ├── admin_router.py # 后台接口\n│   │   └── demo_router.py # 演示接口\n│   ├── types # 声明入参和出参对应的Pydantic模型\n│   │   ├── __init__.py\n│   │   ├── request # 入参模型\n│   │   └── response # 出参模型\n│   ├── service # 就具体业务实现逻辑\n│   │   ├── __init__.py\n│   └── utils # 工具类\n│       ├── __init__.py\n│       └── str_util.py\n├── bin # 相关脚本\n│   ├── genmodels.sh # 生成model脚本\n│   └── updateRequirements.sh # 更新项目依赖脚本\n├── logs # 日志目录\n│   └── app.log\n├── static # 静态资源目录\n│   ├── a.txt\n│   └── test.jpg\n├── requirements.txt #依赖文件\n├── README.md  #项目介绍\n├── main.py # 入口文件\n└── tests # 单元测试目录\n    ├── __init__.py\n    └── local_test.py\n```\n\n### 3.项目启动\n\n#### 3.1 安装依赖\n\n```shell\n➜ pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple\n```\n\n#### 3.2 服务启动\n\n```sh\n# 启动: 可指定 环境配置文件test(.env.test)、prod(.env.prod)\n➜  ./server.sh start --env=test\n准备启动应用程序...\n运行脚本: python main.py  --env=test\n获取配置文件:  .env.test\n打印项目配置: ...\nINFO:     Started server process [36836]\nINFO:     Waiting for application startup.\nINFO:     Application startup complete.\nINFO:     Uvicorn running on http://0.0.0.0:8082 (Press CTRL+C to quit)\n\n# 关闭\n➜  ./server.sh stop \n\n# 重启\n➜  ./server.sh restart \n```\n\n### 4.项目状态\n\n持续学习开发中...\n\n### 5.项目历程  \n\n- [Python框架篇(1):FastApi-快速入门](https://mp.weixin.qq.com/s/AY_MGluXAgr27m2nPByJFw)\n- [Python框架篇(2):FastApi-参数接收和验证](https://mp.weixin.qq.com/s/J2_gJxJk2VLfMXgoH1l8Cw)\n- [Python框架篇(3):FastApi-响应模型](https://mp.weixin.qq.com/s/okmkZXWZ3qwS1cnAceky0w)\n- [Python框架篇(4):FastApi-错误处理](https://mp.weixin.qq.com/s/W6TxoQ_i-CUCKRhorZReaw)\n- [Python框架篇(5):FastApi-中间件使用](https://mp.weixin.qq.com/s/2MFPnly7pv_dhKT3zGw3VA)\n- [Python框架篇(6):FastApi-配置管理](https://mp.weixin.qq.com/s/3TQYLGebfsEmZt_FQBIV1Q)\n- [Python框架篇(7):FastApi-依赖项](https://mp.weixin.qq.com/s/UvTytHAkC2bue-1ee6Ib1w)\n- [Python框架篇(8):FastApi-文件处理](https://mp.weixin.qq.com/s/zOxkbJkDoQCA0fCkWGF00Q)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F52lu%2Ffast-api-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F52lu%2Ffast-api-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F52lu%2Ffast-api-template/lists"}