HTMX + Flask: Modern Python Web Apps, Hold the JavaScript Course

Course Summary

htmx is one of the hottest properties 🔥 in web development today, and for good reason. This framework, along with the libraries and techniques introduced in this course, will have you writing the best Python web apps you've ever written: clean, fast, and interactive without all that frontend overhead.

If you are a Python web developer that has wanted to build more dynamic, interactive apps, but just don't want to (or can't) write a significant portion of your app in a rich frontend JavaScript framework, you'll absolutely love htmx. This library lets you write Python code you love and still add that clientside interactive aspect.

What students are saying

The production quality is high, better than many video courses in fact, and Michael comes across as confident and patient.
-- Marc

Source code and course GitHub repository

github.com/talkpython/htmx-python-course

What's this course about and how is it different?

htmx is a very compelling technology. It's one of the first legitimate libraries that delivers on the promise of dynamic, interactive web applications without complex JavaScript. htmx allows us to write server-side code in any language (Python in our case) and, through a few simple HTML attributes, bring our pages to life.

This is the only course (that we're aware of) that shows you the full lifecycle of building Python and Flask-based applications centered around htmx. Unlike basic tutorials where you'll find only just quick coverage of a simple feature, we take a full-fledged web app and extend it by adding three real-world features all building upon htmx.

Moreover, we show you the right way to use htmx with Flask and Python. The resulting code is incredibly clean and would impress almost any professional web developer.

Sister course for Django developers

If you're using Django rather than Flask, we also have a very popular HTMX + Django course available from Talk Python.

What will we build

In the course, we will add a bunch of htmx-powered features to an existing application. This app, called Video Collector, is a beautiful Flask web app that allows us to save, explore, search, and play videos we've collected from YouTube.

Demo app from the course

The Video Collector application we'll build during this course.

What topics are covered

In this course, you will:

  • See how htmx differs from common JavaScript front-end frameworks such as Vue and React.
  • Understand the server-side exchange enabled by htmx attributes (e.g. hx-trigger).
  • Add click to edit to an existing data-driven Flask application.
  • Learn about the jinja-partials package to refactor our jinja2 templates (with or without htmx).
  • Add deep linking to our dynamic web application, allowing us to share links into interactive segments.
  • Add active search to an existing data-driven Flask application.
  • Implement browser history for htmx actions (allowing back and forth navigation).
  • Add infinite scroll to our app.
  • Distinguish between full page requests and partial htmx requests within a single view method in Flask.
  • And lots more

View the full course outline.

Who is this course for?

This course is for anyone who creates Python web applications and needs them to be more interactive in manners often characterized as SPAs (single page applications) but doesn't want to (re)write the application largely in a complex JavaScript frontend framework such as Vue.js or React.js.

The experience level for taking this course is not significantly high. You'll need

  • A basic understanding of how Flask works
  • Experience with core Python concepts (such as classes, functions, and decorators) but nothing complex (such as async or metaclasses)
  • You'll need to know a little about HTML and HTTP

That's it.

Concepts backed by concise visuals

While exploring a topic interactively with demos and live code is very engaging, it can mean losing the forest for the trees. That's why when we hit a new topic, we stop and discuss it with concise and clear visuals.

Here's an example of understanding how we are using the jinja-partials package to isolate and reuse Jinja subtemplates, a very important feature for integrating htmx.

Example: Concepts backed by concise visuals

Get hands-on for almost every chapter

While watching videos is great to give you that high level overview of what you need to know about a technology, nothing makes that skill your own like writing actual code and creating real webapps that use htmx.

In this course, you'll have access to all the source code at github.com/talkpython/htmx-python-course.

Each chapter, which corresponds to each major feature roughly, has a starter and final code section. This means you can start from the beginning and work along side us as we build out final application. And if you get stuck, or want to jump around, you can grab the starter code for any chapter and carry on from them.

You are strongly encouraged to work along as you go through the course. Remember that in programming, you learn by doing.

This course is delivered in very high resolution

Example of 1440p high res video

This course is delivered in 1440p (4x the pixels as 720p). When you're watching the videos for this course, it will feel like you're sitting next to the instructor looking at their screen.

Every little detail, menu item, and icon is clear and crisp. Watch the introductory video at the top of this page to see an example.

Follow along with subtitles and transcripts

Each course comes with subtitles and full transcripts. The transcripts are available as a separate searchable page for each lecture. They also are available in course-wide search results to help you find just the right lecture.

Each course has subtitles available in the video player.

Who am I? Why should you take my course?

Who is Michael Kennedy?

My name is Michael, nice to meet you. ;) There are a couple of reasons I'm especially qualified to teach you Python.

 1. I'm the host of the #1 podcast on Python called Talk Python To Me. Over there, I've interviewed many of the leaders and creators in the Python community. I bring that perspective to all the courses I create.

 2. I've been a professional software trainer for over 10 years. I have taught literally thousands of professional developers in hundreds of courses throughout the world.

 3. Students have loved my courses. Here are just a few quotes from past students of mine.

"Michael is super knowledgeable, loves his craft, and he conveys it all well. I would highly recommend his training class anytime." - Robert F.
"Michael is simply an outstanding instructor." - Kevin R.
"Michael was an encyclopedia for the deep inner workings of Python. Very impressive." - Neal L.

Free office hours keep you from getting stuck

One of the challenges of self-paced online learning is getting stuck. It can be hard to get the help you need to get unstuck.

That's why at Talk Python Training, we offer live, online office hours. You drop in and join a group of fellow students to chat about your course progress and see solutions via screen sharing.

Just visit your account page to see the upcoming office hour schedule.

The time to act is now

htmx is one of the hottest properties in the web world today, and for good reason. This framework, along with the libraries and techniques introduced in this course, will have you writing the best Python web apps you've ever written: clean, fast, and interactive without all that frontend overhead.

Not sure? You've got nothing to lose. Every one of our courses comes with a 2-week money-back guarantee including this one!

Course Outline: Chapters and Lectures

Welcome to the course
18:58
Introduction to the course
2:28
What is htmx?
5:03
The HOWL stack
1:36
The big ideas covered in this course
3:04
Student prerequisites
1:22
Vue, React, and htmx: A quick comparison
2:52
Git the source code
0:54
Meet your instructor: Michael Kennedy
1:09
PyCharm Pro for Free
0:30
Exploring the examples on htmx.org
13:12
A tour of htmx examples
1:09
Example: Infinite scroll
2:40
Example: Active search
3:29
Example: Lazy loading
2:37
Example: Bulk update
3:17
Surveying the non-js-enabled Flask app
16:45
Introducing our web app: Video Collector
1:26
Setting up and running the Flask app
3:38
Key elements of code organization
5:49
Concept: Pydantic models
2:03
Concept: View models
2:17
Concept: Code organization
1:32
Feature 1: Click-to-edit
41:38
Our first feature: Click to edit
0:49
Introduction to building the non-htmx form
0:57
Adding the HTML for the add video form
6:35
'Add video' view methods
7:09
Creating the new video in the database
3:36
Installing htmx
2:26
A clean, enable add button, without the form
4:55
Server returns the form on-demand
3:42
Changing our mind, adding a cancel option
5:58
Concept: Showing the edit UI
2:04
Concept: Creating or canceling the video creation
1:51
Concept: Processing the form submission on the server
1:36
HTML template partials
14:47
What do you mean by partials?
1:48
The jinja-partials package
2:05
Partials: A more realistic example
1:49
Installing jinja-partials
3:48
Removing duplication of add video HTML
3:53
Concept: Using partials
1:24
Feature 2: Active search
37:41
Introducing active search
0:47
Where we're headed with active search
2:00
Create the search page skeleton
4:06
Search text is better as an optional URL element
1:28
Performing the server-side search
4:14
HTML input controls for search
2:29
Searching as they type with htmx
7:09
Rendering the videos found in search
4:28
Search history in the address bar
2:21
Deep linking to search results
4:01
Concept: Triggering the search with htmx
1:13
Concept: Is a request htmx originated?
1:24
Concept: Supporting deep linking
2:01
Feature 3: Infinite scroll
22:05
Introducing infinite scroll
0:53
Popular sites using infinite scroll
1:52
Reorganizing the feed HTML for infinite scroll
4:18
Returning a limited set of videos
3:23
The htmx scroll trigger
5:22
Implementing more videos on the server
3:54
Concept: Triggering another page as you scroll
2:23
Course conclusion and review
17:50
HOWL for the finish line
1:58
Examples first, docs second
1:03
Core elements of the starter Flask app
3:13
Click to edit functionality
1:54
Jinja-partials package
2:10
Active search with htmx
2:16
Partial or full response?
1:59
Infinite scroll with htmx
2:18
Thank you and goodbye
0:59
Buy for $49 + tax Bundle and save 85% Team Gift

Questions? Send us an email: contact@talkpython.fm

Talk Python's Mastodon Michael Kennedy's Mastodon