Рет қаралды 52,791
In this video, we look at how to return HTML templates with the FastAPI web framework in Python. We will use Jinja2 templates, and will set our FastAPI function up to return a template response.
We'll also look at how to integrate with the HTMX library, allowing us to easily utilise dynamic data loading in our FastAPI application.
We will also apply some very basic styles to our page using TailwindCSS.
▶️ Full Playlist:
• FastAPI
📌 𝗖𝗵𝗮𝗽𝘁𝗲𝗿𝘀:
00:00 Intro
00:31 Setup
02:56 Creating FastAPI route
05:28 Adding HTMX and TailwindCSS
06:26 Displaying data in HTML table
07:52 Returning data from FastAPI route
09:26 Adding HTMX attributes to button
12:17 FastAPI headers
14:33 Adding hx-swap attribute
☕️ 𝗕𝘂𝘆 𝗺𝗲 𝗮 𝗰𝗼𝗳𝗳𝗲𝗲:
To support the channel and encourage new videos, please consider buying me a coffee here:
ko-fi.com/bugb...
𝗦𝗼𝗰𝗶𝗮𝗹 𝗠𝗲𝗱𝗶𝗮:
📖 Blog: www.bugbytes.i...
👾 Github: github.com/bug...
🐦 Twitter: / bugbytesio
📚 𝗙𝘂𝗿𝘁𝗵𝗲𝗿 𝗿𝗲𝗮𝗱𝗶𝗻𝗴 𝗮𝗻𝗱 𝗶𝗻𝗳𝗼𝗿𝗺𝗮𝘁𝗶𝗼𝗻:
HTMX CDN: htmx.org/docs/...
TailwindCSS CDN: tailwindcss.co...
FastAPI docs: fastapi.tiango...
FastAPI headers: fastapi.tiango...
FastAPI templates: fastapi.tiango...
#fastapi #python