Skip to content

🛠️ - 📉

🥇, 👆 💪 💚 👀 🔰 🌌 ℹ FastAPI & 🤚 ℹ.

🛠️

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

🕹 🌐 ⏮️ venv

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

$ python -m venv env

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

🔓 🌐

🔓 🆕 🌐 ⏮️:

$ source ./env/bin/activate
$ .\env\Scripts\Activate.ps1

⚖️ 🚥 👆 ⚙️ 🎉 🖥 (✅ 🐛 🎉):

$ source ./env/Scripts/activate

✅ ⚫️ 👷, ⚙️:

$ which pip

some/directory/fastapi/env/bin/pip
$ Get-Command pip

some/directory/fastapi/env/bin/pip

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

⚒ 💭 👆 ✔️ 📰 🐖 ⏬ 🔛 👆 🕹 🌐 ❎ ❌ 🔛 ⏭ 📶:

$ python -m pip install --upgrade pip

---> 100%

Tip

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

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

🐖

⏮️ 🔓 🌐 🔬 🔛:

$ 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

👆 💪 🚮 🏤 ⏮️ 🔀 🔑 ♻ 🚲 📨.

✅ 🩺 🔃 ❎ 🚲 📨 📄 ✔ ⚫️ ⚖️ 📨 🔀.

  • ✅ ❔ 👀 🚥 📤 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 🩺 🕸, 👆 🔜 👀 👈 🔠 🇪🇸 ✔️ 🌐 📃. ✋️ 📃 🚫 💬 & ✔️ 📨 🔃 ❌ ✍.

✋️ 🕐❔ 👆 🏃 ⚫️ 🌐 💖 👉, 👆 🔜 🕴 👀 📃 👈 ⏪ 💬.

🔜 ➡️ 💬 👈 👆 💚 🚮 ✍ 📄 ⚒.

  • 📁 📁:
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 👆 🖥, 👆 💪 🔬 🖥 🇹🇼 📟 👈 📔 💯, & 👀 🚥 📤 🙆 🇹🇼 ❌.