1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-07-01 20:15:23 +02:00
tldr/pages.zh/common/fastapi.md
Harshavardhan dd977f9733
fastapi: add page and Chinese and Korean translation (#17033)
* Added tldr pages for fastapi[standard]

* Removed the trailing white spaces

* Updated the links

* CLI to run -> Run

* Modified commands to be more general

* Modified changes for {{subcommand}}

* Update pages.zh/common/fastapi.md

* fixed bot issues

* fixed the translation bot issues

---------

Co-authored-by: Wiktor Perskawiec <wiktor@perskawiec.cc>
2025-07-01 14:23:57 +09:00

716 B

fastapi

运行 FastAPI 应用的命令行工具,底层使用 Uvicorn。 更多信息:https://manned.org/fastapi.

  • 使用自动重载运行 FastAPI 应用(用于开发):

fastapi run {{路径/文件.py}} --reload

  • 在开发模式下运行应用:

fastapi dev {{路径/文件.py}}

  • 指定运行的主机和端口:

fastapi run {{路径/文件.py}} --host {{主机地址}} --port {{端口}}

  • 设置应用变量名(如果不是 app)或指定自定义应用目录:

fastapi run {{路径/文件.py}} --app-dir {{路径/到/应用}} --app {{自定义_app_名称}}

  • 显示帮助信息:

fastapi --help

  • 显示子命令的帮助信息:

fastapi {{子命令}} --help