Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4881d1e

Browse files
📝 Update docs forfastapi-cli (#13031)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent293d7c3 commit4881d1e

File tree

2 files changed

+34
-42
lines changed

2 files changed

+34
-42
lines changed

‎docs/en/docs/fastapi-cli.md‎

Lines changed: 33 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -9,47 +9,39 @@ To run your FastAPI app for development, you can use the `fastapi dev` command:
99
<divclass="termy">
1010

1111
```console
12-
$<font color="#4E9A06">fastapi</font> dev<u style="text-decoration-style:single">main.py</u>
13-
<font color="#3465A4">INFO </font> Using path <font color="#3465A4">main.py</font>
14-
<font color="#3465A4">INFO </font> Resolved absolute path <font color="#75507B">/home/user/code/awesomeapp/</font><font color="#AD7FA8">main.py</font>
15-
<font color="#3465A4">INFO </font> Searching for package file structure from directories with <font color="#3465A4">__init__.py</font> files
16-
<font color="#3465A4">INFO </font> Importing from <font color="#75507B">/home/user/code/</font><font color="#AD7FA8">awesomeapp</font>
17-
18-
╭─ <font color="#8AE234"><b>Python module file</b></font> ─╮
19-
│ │
20-
│ 🐍 main.py │
21-
│ │
22-
╰──────────────────────╯
23-
24-
<font color="#3465A4">INFO </font> Importing module <font color="#4E9A06">main</font>
25-
<font color="#3465A4">INFO </font> Found importable FastAPI app
26-
27-
╭─ <font color="#8AE234"><b>Importable FastAPI app</b></font> ─╮
28-
│ │
29-
│ <span style="background-color:#272822"><font color="#FF4689">from</font></span><span style="background-color:#272822"><font color="#F8F8F2"> main </font></span><span style="background-color:#272822"><font color="#FF4689">import</font></span><span style="background-color:#272822"><font color="#F8F8F2"> app</font></span><span style="background-color:#272822"> </span> │
30-
│ │
31-
╰──────────────────────────╯
32-
33-
<font color="#3465A4">INFO </font> Using import string <font color="#8AE234"><b>main:app</b></font>
34-
35-
<span style="background-color:#C4A000"><font color="#2E3436">╭────────── FastAPI CLI - Development mode ───────────╮</font></span>
36-
<span style="background-color:#C4A000"><font color="#2E3436">│ │</font></span>
37-
<span style="background-color:#C4A000"><font color="#2E3436">│ Serving at: http://127.0.0.1:8000 │</font></span>
38-
<span style="background-color:#C4A000"><font color="#2E3436">│ │</font></span>
39-
<span style="background-color:#C4A000"><font color="#2E3436">│ API docs: http://127.0.0.1:8000/docs │</font></span>
40-
<span style="background-color:#C4A000"><font color="#2E3436">│ │</font></span>
41-
<span style="background-color:#C4A000"><font color="#2E3436">│ Running in development mode, for production use: │</font></span>
42-
<span style="background-color:#C4A000"><font color="#2E3436">│ │</font></span>
43-
<span style="background-color:#C4A000"><font color="#2E3436">│ </font></span><span style="background-color:#C4A000"><font color="#555753"><b>fastapi run</b></font></span><span style="background-color:#C4A000"><font color="#2E3436"> │</font></span>
44-
<span style="background-color:#C4A000"><font color="#2E3436">│ │</font></span>
45-
<span style="background-color:#C4A000"><font color="#2E3436">╰─────────────────────────────────────────────────────╯</font></span>
46-
47-
<font color="#4E9A06">INFO</font>: Will watch for changes in these directories: [&apos;/home/user/code/awesomeapp&apos;]
48-
<font color="#4E9A06">INFO</font>: Uvicorn running on <b>http://127.0.0.1:8000</b> (Press CTRL+C to quit)
49-
<font color="#4E9A06">INFO</font>: Started reloader process [<font color="#34E2E2"><b>2265862</b></font>] using <font color="#34E2E2"><b>WatchFiles</b></font>
50-
<font color="#4E9A06">INFO</font>: Started server process [<font color="#06989A">2265873</font>]
51-
<font color="#4E9A06">INFO</font>: Waiting for application startup.
52-
<font color="#4E9A06">INFO</font>: Application startup complete.
12+
$<font color="#4E9A06">fastapi</font> dev<u style="text-decoration-style:solid">main.py</u>
13+
14+
<span style="background-color:#009485"><font color="#D3D7CF"> FastAPI </font></span> Starting development server 🚀
15+
16+
Searching for package file structure from directories with
17+
<font color="#3465A4">__init__.py</font> files
18+
Importing from <font color="#75507B">/home/user/code/</font><font color="#AD7FA8">awesomeapp</font>
19+
20+
<span style="background-color:#007166"><font color="#D3D7CF"> module </font></span> 🐍 main.py
21+
22+
<span style="background-color:#007166"><font color="#D3D7CF"> code </font></span> Importing the FastAPI app object from the module with the
23+
following code:
24+
25+
<u style="text-decoration-style:solid">from </u><u style="text-decoration-style:solid"><b>main</b></u><u style="text-decoration-style:solid"> import </u><u style="text-decoration-style:solid"><b>app</b></u>
26+
27+
<span style="background-color:#007166"><font color="#D3D7CF"> app </font></span> Using import string: <font color="#3465A4">main:app</font>
28+
29+
<span style="background-color:#007166"><font color="#D3D7CF"> server </font></span> Server started at <font color="#729FCF"><u style="text-decoration-style:solid">http://127.0.0.1:8000</u></font>
30+
<span style="background-color:#007166"><font color="#D3D7CF"> server </font></span> Documentation at <font color="#729FCF"><u style="text-decoration-style:solid">http://127.0.0.1:8000/docs</u></font>
31+
32+
<span style="background-color:#007166"><font color="#D3D7CF"> tip </font></span> Running in development mode, for production use:
33+
<b>fastapi run</b>
34+
35+
Logs:
36+
37+
<span style="background-color:#007166"><font color="#D3D7CF"> INFO </font></span> Will watch for changes in these directories:
38+
<b>[</b><font color="#4E9A06">&apos;/home/user/code/awesomeapp&apos;</font><b>]</b>
39+
<span style="background-color:#007166"><font color="#D3D7CF"> INFO </font></span> Uvicorn running on <font color="#729FCF"><u style="text-decoration-style:solid">http://127.0.0.1:8000</u></font> <b>(</b>Press CTRL+C to
40+
quit<b>)</b>
41+
<span style="background-color:#007166"><font color="#D3D7CF"> INFO </font></span> Started reloader process <b>[</b><font color="#34E2E2"><b>383138</b></font><b>]</b> using WatchFiles
42+
<span style="background-color:#007166"><font color="#D3D7CF"> INFO </font></span> Started server process <b>[</b><font color="#34E2E2"><b>383153</b></font><b>]</b>
43+
<span style="background-color:#007166"><font color="#D3D7CF"> INFO </font></span> Waiting for application startup.
44+
<span style="background-color:#007166"><font color="#D3D7CF"> INFO </font></span> Application startup complete.
5345
```
5446

5547
</div>

‎tests/test_fastapi_cli.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def test_fastapi_cli():
2222
encoding="utf-8",
2323
)
2424
assertresult.returncode==1,result.stdout
25-
assert"Using path non_existent_file.py"inresult.stdout
25+
assert"Path does not exist non_existent_file.py"inresult.stdout
2626

2727

2828
deftest_fastapi_cli_not_installed():

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2026 Movatter.jp