You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

11 KiB

🛠️ - 📉

🥇, 👆 💪 💚 👀 🔰 🌌 ℹ FastAPI & 🤚 ℹ{.internal-link target=_blank}.

🛠️

🚥 👆 🖖 🗃 & 👆 💭 👈 👆 💪 🤿 📟, 📥 📄🆙 👆 🌐.

🕹 🌐 ⏮️ venv

👆 💪 ✍ 🕹 🌐 📁 ⚙️ 🐍 venv 🕹:

$ python -m venv env

👈 🔜📁 ./env/ ⏮️ 🐍 💱 & ⤴️ 👆 🔜 💪 📦 👈 🌐.

🔓 🌐

🔓 🆕 🌐 ⏮️:

=== "💾, 🇸🇻"

<div class="termy">

```console
$ source ./env/bin/activate
```

</div>

=== "🚪 📋"

<div class="termy">

```console
$ .\env\Scripts\Activate.ps1
```

</div>

=== "🚪 🎉"

⚖️ 🚥 👆 ⚙️ 🎉 🖥 (✅ <a href="https://gitforwindows.org/" class="external-link" target="_blank">🐛 🎉</a>):

<div class="termy">

```console
$ source ./env/Scripts/activate
```

</div>

👷, ⚙️:

=== "💾, 🇸🇻, 🚪 🎉"

<div class="termy">

```console
$ which pip

some/directory/fastapi/env/bin/pip
```

</div>

=== "🚪 📋"

<div class="termy">

```console
$ Get-Command pip

some/directory/fastapi/env/bin/pip
```

</div>

🚥 🎦 pip 💱 env/bin/pip ⤴️ 👷. 👶

💭 👆 ✔️ 📰 🐖 🔛 👆 🕹 🌐 🔛📶:

$ python -m pip install --upgrade pip

---> 100%

!!! tip 🔠 🕰 👆 🆕 📦 ⏮️ pip 🔽 👈 🌐, 🔓 🌐 🔄.

👉 ⚒ 💭 👈 🚥 👆 ⚙️ 📶 📋 ❎ 👈 📦, 👆 ⚙️ 1️⃣ ⚪️➡️ 👆 🇧🇿 🌐 &amp; 🚫 🙆 🎏 👈 💪 ❎ 🌐.

🐖

⏮️ 🔓 🌐 🔬 🔛:

$ pip install -r requirements.txt

---> 100%

🔜 🌐 🔗 & 👆 🇧🇿 FastAPI 👆 🇧🇿 🌐.

⚙️ 👆 🇧🇿 FastAPI

🚥 👆🐍 📁 👈 🗄 & ⚙️ FastAPI, & 🏃 ⏮️ 🐍 ➡️ 👆 🇧🇿 🌐, 🔜 ⚙️ 👆 🇧🇿 FastAPI ℹ 📟.

& 🚥 👆👈 🇧🇿 FastAPI ℹ 📟, ⏮️ -e, 🕐 👆 🏃 👈 🐍 📁 🔄, 🔜 ⚙️ 🍋 FastAPI 👆 ✍.

👈 🌌, 👆 🚫 ✔️ "" 👆 🇧🇿 💪 💯 🔠 🔀.

📁

📤👈 👆 💪 🏃 👈 🔜 📁 & 🧹 🌐 👆 📟:

$ bash scripts/format.sh

🔜 🚘-😇 🌐 👆 🗄.

😇 👫 ☑, 👆 💪 ✔️ FastAPI 🌐 👆 🌐, ⏮️ 📋 📄 🔛 ⚙️ -e.

🩺

🥇, ⚒ 💭 👆🆙 👆 🌐 🔬 🔛, 👈 🔜 🌐 📄.

🧾 ⚙️ .

& 📤 🧰/✍ 🥉 🍵./scripts/docs.py.

!!! tip 👆 🚫 💪 👀 📟 ./scripts/docs.py, 👆 ⚙️ 📋 ⏸.

🌐 🧾📁 📁 ./docs/en/.

📚 🔰 ✔️ 🍫 📟.

🌅 💼, 👫 🍫 📟🏁 🈸 👈 💪 🏃.

👐, 👈 🍫 📟 🚫🔘 ✍, 👫 🐍 📁 ./docs_src/ 📁.

& 👈 🐍 📁 🔌/💉 🧾 🕐 🏭 🕸.

🩺 💯

🏆 💯 🤙 🏃 🛡 🖼 ℹ 📁 🧾.

👉 ℹ ⚒ 💭 👈:

  • 🧾 🆙 📅.
  • 🧾 🖼 💪 🏃.
  • 🌅📔 🧾, 🚚 💯 💰.

⏮️ 🇧🇿 🛠️, 📤👈 🏗 🕸 & 🙆 🔀, 🖖-🔫:

$ python ./scripts/docs.py live

<span style="color: green;">[INFO]</span> Serving on http://127.0.0.1:8008
<span style="color: green;">[INFO]</span> Start watching changes
<span style="color: green;">[INFO]</span> Start detecting changes

🔜 🍦 🧾 🔛 http://127.0.0.1:8008.

👈 🌌, 👆 💪🧾/ℹ 📁 & 👀 🔀 🖖.

🏎 ✳ (📦)

👩‍🌾 📥 🎦 👆 ⚙️./scripts/docs.py ⏮️ python 📋 🔗.

👆 💪 ⚙️ 🏎 ✳, & 👆 🔜 🤚👆 📶 📋 ⏮️ 🛠️.

🚥 👆 🏎 ✳, 👆 💪 🛠️ ⏮️:

$ typer --install-completion

zsh completion installed in /home/user/.bashrc.
Completion will take effect once you restart the terminal.

📱 & 🩺 🎏 🕰

🚥 👆 🏃 🖼 ⏮️, :

$ uvicorn tutorial001:app --reload

<span style="color: green;">INFO</span>:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)

Uvicorn 🔢 🔜 ⚙️8000, 🧾 🔛8008 🏆 🚫 ⚔.

⏮️📶 🌅 👍 & 💪 🚫 🔨 🍵➡️ 👪. 👶 👶

📥 📶⏮️ ✍.

💁‍♂ & 📄

  • ♻ 🚲 📨 👆 🇪🇸 & 🚮 📄🔀 ⚖️👫.

!!! tip 👆 💪 🚮 🏤 ⏮️ 🔀 🔑🚲 📨.

✅ 🩺 🔃 <a href="https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-request-reviews" class="external-link" target="_blank">❎ 🚲 📨 📄</a> ✔ ⚫️ ⚖️ 📨 🔀.
  • 👀 🚥 📤 1️⃣ 🛠️👆 🇪🇸.

  • 🚮 👁 🚲 📨 📍 📃 💬. 👈 🔜🌅 🎏 📄 ️.

🇪🇸 👤 🚫 💬, 👤 🔜 📚 🎏 📄 ✍ ⏭ 🔗.

  • 👆 💪 🚥 📤👆 🇪🇸 & 🚮 📄 👫, 👈 🔜👤 💭 👈 ✍ ☑ & 👤 💪 🔗 ️.

  • ⚙️ 🎏 🐍 🖼 & 🕴 💬🩺. 👆 🚫 ✔️ 🔀 🕳 👉 👷.

  • ⚙️ 🎏 🖼, 📁 📛, & 🔗. 👆 🚫 ✔️ 🔀 🕳 👷.

  • 2️⃣-🔤 📟 🇪🇸 👆 💚 💬 👆 💪 ⚙️ 🏓 📇 💾 6️⃣3️⃣9️⃣-1️⃣ 📟.

🇪🇸

➡️ 💬 👆 💚 💬 📃 🇪🇸 👈 ✔️📃, 💖 🇪🇸.

💼 🇪🇸, 2️⃣-🔤 📟 es. , 📁 🇪🇸🔎 docs/es/.

!!! tip 👑 ("🛂") 🇪🇸 🇪🇸, 🔎 docs/en/.

🔜 🏃 🖖 💽 🩺 🇪🇸:

// Use the command "live" and pass the language code as a CLI argument
$ python ./scripts/docs.py live es

<span style="color: green;">[INFO]</span> Serving on http://127.0.0.1:8008
<span style="color: green;">[INFO]</span> Start watching changes
<span style="color: green;">[INFO]</span> Start detecting changes

🔜 👆 💪 🚶 http://127.0.0.1:8008 & 👀 👆 🔀 🖖.

🚥 👆 👀 FastAPI 🩺 🕸, 👆 🔜 👀 👈 🔠 🇪🇸 ✔️ 🌐 📃. 📃 🚫 💬 & ✔️ 📨 🔃 ✍.

🕐 👆 🏃 🌐 💖 👉, 👆 🔜 🕴 👀 📃 👈 💬.

🔜 ➡️ 💬 👈 👆 💚 🚮📄 {.internal-link target=_blank}.

  • 📁 📁:
docs/en/docs/features.md
  • 📋 🎏 🗺 🇪🇸 👆 💚 💬, :
docs/es/docs/features.md

!!! tip 👀 👈 🕴 🔀 ➡ & 📁 📛 🇪🇸 📟, ➡️ en es.

  • 🔜 📂 📁 📁 🇪🇸:
docs/en/mkdocs.yml
  • 🔎 🥉 🌐 👈 docs/features.md 🔎 📁 📁. 👱 💖:
site_name: FastAPI
# More stuff
nav:
- FastAPI: index.md
- Languages:
  - en: /
  - es: /es/
- features.md
  • 📂 📁 📁 🇪🇸 👆 ✍, :
docs/es/mkdocs.yml
  • 🚮 📤🎏 🗺 🇪🇸, :
site_name: FastAPI
# More stuff
nav:
- FastAPI: index.md
- Languages:
  - en: /
  - es: /es/
- features.md

💭 👈 🚥 📤 🎏 , 🆕 ⏮️ 👆 🎏🇪🇸 .

🚥 👆 🚶 👆 🖥 👆 🔜 👀 👈 🔜 🩺 🎦 👆 🆕 📄. 👶

🔜 👆 💪 💬 🌐 & 👀 👀 👆 🖊 📁.

🆕 🇪🇸

➡️ 💬 👈 👆 💚 🚮🇪🇸 👈 🚫 💬, 🚫 📃.

➡️ 💬 👆 💚 🚮🇭🇹, & 🚫 📤 🩺.

🔗 ➡️ 🔛, 📟 "🇭🇹" ht.

🔁 🏃 ✍ 🏗 🆕📁:

// Use the command new-lang, pass the language code as a CLI argument
$ python ./scripts/docs.py new-lang ht

Successfully initialized: docs/ht
Updating ht
Updating en

🔜 👆 💪 👆 📟 👨‍🎨 📁 docs/ht/.

!!! tip ✍ 🥇 🚲 📨 ⏮️ 👉, ⚒ 🆙 📳 🆕 🇪🇸, ⏭ ✍.

👈 🌌 🎏 💪 ℹ ⏮️ 🎏 📃 ⏪ 👆 👷 🔛 🥇 🕐. 👶

▶️👑 📃, docs/ht/index.md.

⤴️ 👆 💪 😣 ⏮️ ⏮️ 👩‍🌾, "♻ 🇪🇸".

🆕 🇪🇸 🚫 🐕‍🦺

🚥 🕐 🏃‍♂ 🖖 💽👆 🤚 🔃 🇪🇸 🚫 🐕‍🦺, 🕳 💖:

 raise TemplateNotFound(template)
jinja2.exceptions.TemplateNotFound: partials/language/xx.html

👈👈 🎢 🚫 🐕‍🦺 👈 🇪🇸 (👉 💼, ⏮️ 2️⃣-🔤 📟 xx).

🚫 😟, 👆 💪🎢 🇪🇸 🇪🇸 & ⤴️ 💬 🎚 🩺.

🚥 👆 💪 👈, ✍ mkdocs.yml 👆 🆕 🇪🇸, 🔜 ✔️ 🕳 💖:

site_name: FastAPI
# More stuff
theme:
  # More stuff
  language: xx

🔀 👈 🇪🇸 ➡️ xx (➡️ 👆 🇪🇸 📟) en.

⤴️ 👆 💪 ▶️ 🖖 💽 🔄.

🎮 🏁

🕐 👆 ⚙️./scripts/docs.py ⏮️ live 📋 ️ 🕴 🎦 📁 & ✍ 💪 ⏮️ 🇪🇸.

🕐 👆 🔨, 👆 💪 💯 🌐 🔜 👀 💳.

👈, 🥇 🏗 🌐 🩺:

// Use the command "build-all", this will take a bit
$ python ./scripts/docs.py build-all

Updating es
Updating en
Building docs for: en
Building docs for: es
Successfully built docs for: es
Copying en index.md to README.md

👈 🏗 🌐 🩺 ./docs_build/ 🔠 🇪🇸. 👉 🔌 🙆 📁 ⏮️ ✍, ⏮️ 🗒 💬 👈 "👉 📁 🚫 ✔️ ✍". 👆 🚫 ✔️ 🕳 ⏮️ 👈 📁.

⤴️ ️ 🏗 🌐 👈 🔬 🕸 🔠 🇪🇸, 🌀 👫, & 🏗 🏁 🔢 ./site/.

⤴️ 👆 💪 🍦 👈 ⏮️ 📋 serve:

// Use the command "serve" after running "build-all"
$ python ./scripts/docs.py serve

Warning: this is a very simple server. For development, use mkdocs serve instead.
This is here only to preview a site with translations already built.
Make sure you run the build-all command first.
Serving at: http://127.0.0.1:8008

💯

📤👈 👆 💪 🏃 🌐 💯 🌐 📟 & 🏗 💰 📄 🕸:

$ bash scripts/test-cov-html.sh

👉 📋 🏗 📁 ./htmlcov/, 🚥 👆 📂 📁 ./htmlcov/index.html 👆 🖥, 👆 💪 🔬 🖥 🇹🇼 📟 👈 📔 💯, & 👀 🚥 📤 🙆 🇹🇼 .