-
-
Notifications
You must be signed in to change notification settings - Fork 9.5k
Add Chinese translation for tutorial intro doc #1202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
tiangolo
merged 2 commits into
fastapi:master
from
waynerv:translate-zh-user-guide-intro
May 16, 2020
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| # 教程 - 用户指南 - 简介 | ||
|
|
||
| 本教程将一步步向你展示如何使用 **FastAPI** 的绝大部分特性。 | ||
|
|
||
| 各个章节的内容循序渐进,但是又围绕着单独的主题,所以你可以直接跳转到某个章节以解决你的特定需求。 | ||
|
|
||
| 本教程同样可以作为将来的参考手册。 | ||
|
|
||
| 你可以随时回到本教程并查阅你需要的内容。 | ||
|
|
||
| ## 运行代码 | ||
|
|
||
| 所有代码片段都可以复制后直接使用(它们实际上是经过测试的 Python 文件)。 | ||
|
|
||
| 要运行任何示例,请将代码复制到 `main.py` 文件中,然后使用以下命令启动 `uvicorn`: | ||
|
|
||
| <div class="termy"> | ||
|
|
||
| ```console | ||
| $ uvicorn main:app --reload | ||
|
|
||
| <span style="color: green;">INFO</span>: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit) | ||
| <span style="color: green;">INFO</span>: Started reloader process [28720] | ||
| <span style="color: green;">INFO</span>: Started server process [28722] | ||
| <span style="color: green;">INFO</span>: Waiting for application startup. | ||
| <span style="color: green;">INFO</span>: Application startup complete. | ||
| ``` | ||
|
|
||
| </div> | ||
|
|
||
| 强烈建议你在本地编写或复制代码,对其进行编辑并运行。 | ||
|
|
||
| 在编辑器中使用 FastAPI 会真正地展现出它的优势:只需要编写很少的代码,所有的类型检查,代码补全等等。 | ||
|
|
||
| --- | ||
|
|
||
| ## 安装 FastAPI | ||
|
|
||
| 第一个步骤是安装 FastAPI。 | ||
|
|
||
| 为了使用本教程,你可能需要安装所有的可选依赖及对应功能: | ||
|
|
||
| <div class="termy"> | ||
|
|
||
| ```console | ||
| $ pip install fastapi[all] | ||
|
|
||
| ---> 100% | ||
| ``` | ||
|
|
||
| </div> | ||
|
|
||
| ......以上安装还包括了 `uvicorn`,你可以将其用作运行代码的服务器。 | ||
|
|
||
| !!! note | ||
| 你也可以分开来安装。 | ||
|
|
||
| 假如你想将应用程序部署到生产环境,你可能要执行以下操作: | ||
|
|
||
| ``` | ||
| pip install fastapi | ||
| ``` | ||
|
|
||
| 并且安装`uvicorn`来作为服务器: | ||
|
|
||
| ``` | ||
| pip install uvicorn | ||
| ``` | ||
|
|
||
| 然后对你想使用的每个可选依赖项也执行相同的操作。 | ||
|
|
||
| ## 进阶用户指南 | ||
|
|
||
| 在本**教程-用户指南**之后,你可以阅读**进阶用户指南**。 | ||
|
|
||
| **进阶用户指南**以本教程为基础,使用相同的概念,并教授一些额外的特性。 | ||
|
|
||
| 但是你应该先阅读**教程-用户指南**(即你现在正在阅读的内容)。 | ||
|
|
||
| 教程经过精心设计,使你可以仅通过**教程-用户指南**来开发一个完整的应用程序,然后根据你的需要,使用**进阶用户指南**中的一些其他概念,以不同的方式来扩展它。 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leaving space before and after
uvicorn.