From bd0fe4eb3927436437eb5e13870cbaae28ba7ece Mon Sep 17 00:00:00 2001 From: Waket Zheng Date: Wed, 10 Jun 2026 16:12:49 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8C=90=20Update=20Chinese=20translations?= =?UTF-8?q?=20for=20FastAPI=20Cloud?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/zh/docs/advanced/generate-clients.md | 2 +- docs/zh/docs/advanced/json-base64-bytes.md | 2 +- docs/zh/docs/deployment/cloud.md | 2 +- docs/zh/docs/deployment/fastapicloud.md | 24 ++------------- docs/zh/docs/deployment/manually.md | 1 - docs/zh/docs/tutorial/body-multiple-params.md | 2 +- docs/zh/docs/tutorial/first-steps.md | 30 +++++++------------ .../docs/tutorial/security/simple-oauth2.md | 2 +- 8 files changed, 19 insertions(+), 46 deletions(-) diff --git a/docs/zh/docs/advanced/generate-clients.md b/docs/zh/docs/advanced/generate-clients.md index 049241bc90..0ad14a2cd0 100644 --- a/docs/zh/docs/advanced/generate-clients.md +++ b/docs/zh/docs/advanced/generate-clients.md @@ -24,7 +24,7 @@ FastAPI 会自动生成 **OpenAPI 3.1** 规范,因此你使用的任何工具 本节介绍的是由赞助 FastAPI 的公司提供的、具备**风险投资背景**或**公司支持**的方案。这些产品在高质量生成的 SDK 之上,提供了**更多特性**和**集成**。 -通过 ✨ [**赞助 FastAPI**](../help-fastapi.md#sponsor-the-author) ✨,这些公司帮助确保框架及其**生态**保持健康并且**可持续**。 +通过 ✨ [**赞助 FastAPI**](../fastapi-people.md#sponsors) ✨,这些公司帮助确保框架及其**生态**保持健康并且**可持续**。 他们的赞助也体现了对 FastAPI **社区**(也就是你)的高度承诺,不仅关注提供**优秀的服务**,也支持一个**健壮且繁荣的框架**——FastAPI。🙇 diff --git a/docs/zh/docs/advanced/json-base64-bytes.md b/docs/zh/docs/advanced/json-base64-bytes.md index 7792282c72..2bfabb2c40 100644 --- a/docs/zh/docs/advanced/json-base64-bytes.md +++ b/docs/zh/docs/advanced/json-base64-bytes.md @@ -4,7 +4,7 @@ ## Base64 与文件 { #base64-vs-files } -请先考虑是否可以使用 [请求文件](../tutorial/request-files.md) 来上传二进制数据,并使用 [自定义响应 - FileResponse](./custom-response.md#fileresponse--fileresponse-) 来发送二进制数据,而不是把它编码进 JSON。 +请先考虑是否可以使用 [请求文件](../tutorial/request-files.md) 来上传二进制数据,并使用 [自定义响应 - FileResponse](./custom-response.md#fileresponse) 来发送二进制数据,而不是把它编码进 JSON。 JSON 只能包含 UTF-8 编码的字符串,因此无法直接包含原始字节。 diff --git a/docs/zh/docs/deployment/cloud.md b/docs/zh/docs/deployment/cloud.md index 025715f523..05a1eb41dd 100644 --- a/docs/zh/docs/deployment/cloud.md +++ b/docs/zh/docs/deployment/cloud.md @@ -16,7 +16,7 @@ FastAPI Cloud 是 *FastAPI and friends* 开源项目的主要赞助方和资金 ## 云服务商 - 赞助商 { #cloud-providers-sponsors } -还有一些云服务商也会 ✨ [**赞助 FastAPI**](../help-fastapi.md#sponsor-the-author) ✨。🙇 +还有一些云服务商也会 ✨ [**赞助 FastAPI**](../fastapi-people.md#sponsors) ✨。🙇 你也可以考虑按照他们的指南尝试他们的服务: diff --git a/docs/zh/docs/deployment/fastapicloud.md b/docs/zh/docs/deployment/fastapicloud.md index d438709935..fc65da029b 100644 --- a/docs/zh/docs/deployment/fastapicloud.md +++ b/docs/zh/docs/deployment/fastapicloud.md @@ -1,26 +1,6 @@ # FastAPI Cloud { #fastapi-cloud } -你可以用**一条命令**将你的 FastAPI 应用部署到 [FastAPI Cloud](https://fastapicloud.com),如果还没有,去加入候补名单吧。🚀 - -## 登录 { #login } - -请确保你已有 **FastAPI Cloud** 账号(我们已从候补名单向你发出邀请 😉)。 - -然后登录: - -
- -```console -$ fastapi login - -You are logged in to FastAPI Cloud 🚀 -``` - -
- -## 部署 { #deploy } - -现在用**一条命令**部署你的应用: +你可以用**一条命令**将你的 FastAPI 应用部署到 [FastAPI Cloud](https://fastapicloud.com)。🚀
@@ -36,6 +16,8 @@ Deploying to FastAPI Cloud...
+CLI 会自动检测你的 FastAPI 应用并将其部署到云端。如果你尚未登录,浏览器会打开以完成身份验证。 + 就这样!现在你可以通过该 URL 访问你的应用。✨ ## 关于 FastAPI Cloud { #about-fastapi-cloud } diff --git a/docs/zh/docs/deployment/manually.md b/docs/zh/docs/deployment/manually.md index c440aa924b..a395f96da5 100644 --- a/docs/zh/docs/deployment/manually.md +++ b/docs/zh/docs/deployment/manually.md @@ -56,7 +56,6 @@ FastAPI 使用了一种用于构建 Python Web 框架和服务器的标准,称 * [Hypercorn](https://hypercorn.readthedocs.io/): 与 HTTP/2 和 Trio 等兼容的 ASGI 服务器。 * [Daphne](https://github.com/django/daphne): 为 Django Channels 构建的 ASGI 服务器。 * [Granian](https://github.com/emmett-framework/granian): 基于 Rust 的 HTTP 服务器,专为 Python 应用设计。 -* [NGINX Unit](https://unit.nginx.org/howto/fastapi/): NGINX Unit 是一个轻量级且灵活的 Web 应用运行时环境。 ## 服务器主机和服务器程序 { #server-machine-and-server-program } diff --git a/docs/zh/docs/tutorial/body-multiple-params.md b/docs/zh/docs/tutorial/body-multiple-params.md index 39b84904fc..be9b89eee4 100644 --- a/docs/zh/docs/tutorial/body-multiple-params.md +++ b/docs/zh/docs/tutorial/body-multiple-params.md @@ -123,7 +123,7 @@ q: str | None = None 但是,如果你希望它期望一个拥有 `item` 键并在值中包含模型内容的 JSON,就像在声明额外的请求体参数时所做的那样,则可以使用一个特殊的 `Body` 参数 `embed`: ```Python -item: Item = Body(embed=True) +item: Annotated[Item, Body(embed=True)] ``` 比如: diff --git a/docs/zh/docs/tutorial/first-steps.md b/docs/zh/docs/tutorial/first-steps.md index 78db1fefc0..c8984b5bfa 100644 --- a/docs/zh/docs/tutorial/first-steps.md +++ b/docs/zh/docs/tutorial/first-steps.md @@ -180,7 +180,7 @@ entrypoint = "backend.main:app" from backend.main import app ``` -### `fastapi dev` 带路径 { #fastapi-dev-with-path } +### `fastapi dev` 带路径或带 `--entrypoint` CLI 选项 { #fastapi-dev-with-path-or-with-entrypoint-cli-option } 你也可以把文件路径传给 `fastapi dev` 命令,它会尝试推断要使用的 FastAPI 应用对象: @@ -188,29 +188,19 @@ from backend.main import app $ fastapi dev main.py ``` -但这样每次调用 `fastapi` 命令时都需要记得传入正确的路径。 - -另外,其他工具可能无法找到它,例如 [VS Code 扩展](../editor-support.md) 或 [FastAPI Cloud](https://fastapicloud.com),因此推荐在 `pyproject.toml` 中使用 `entrypoint`。 - -### 部署你的应用(可选) { #deploy-your-app-optional } - -你可以选择将 FastAPI 应用部署到 [FastAPI Cloud](https://fastapicloud.com),如果还没有,先去加入候补名单。🚀 - -如果你已经拥有 **FastAPI Cloud** 账户(我们从候补名单邀请了你 😉),你可以用一条命令部署应用。 - -部署前,先确保已登录: - -
+或者,你也可以把 `--entrypoint` 选项传给 `fastapi dev` 命令: ```console -$ fastapi login - -You are logged in to FastAPI Cloud 🚀 +$ fastapi dev --entrypoint main:app ``` -
+但这样每次调用 `fastapi` 命令时都需要记得传入正确的路径或 entrypoint。 + +另外,其他工具可能无法找到它,例如 [VS Code 扩展](../editor-support.md) 或 [FastAPI Cloud](https://fastapicloud.com),因此推荐在 `pyproject.toml` 中使用 `entrypoint`。 + +### 部署你的应用(可选) { #deploy-your-app-optional } -然后部署你的应用: +你可以选择用一条命令将 FastAPI 应用部署到 [FastAPI Cloud](https://fastapicloud.com)。🚀
@@ -226,6 +216,8 @@ Deploying to FastAPI Cloud...
+CLI 会自动检测你的 FastAPI 应用并将其部署到云端。如果你尚未登录,浏览器会打开以完成身份验证。 + 就这些!现在你可以通过该 URL 访问你的应用了。✨ ## 分步概括 { #recap-step-by-step } diff --git a/docs/zh/docs/tutorial/security/simple-oauth2.md b/docs/zh/docs/tutorial/security/simple-oauth2.md index d8d5b561e0..1af521ca0a 100644 --- a/docs/zh/docs/tutorial/security/simple-oauth2.md +++ b/docs/zh/docs/tutorial/security/simple-oauth2.md @@ -146,7 +146,7 @@ UserInDB( /// info | 信息 -`user_dict` 的说明,详见[**更多模型**一章](../extra-models.md#about-user-in-dict)。 +`user_dict` 的说明,详见[**更多模型**一章](../extra-models.md#unpacking-a-dict)。 ///