CDNs Made Easy: Accelerate Your Python Web Apps Course

Course Summary

You’re ready to launch your Python app. You want it to FLY of course. Static resources can be a huge portion of that equation. Leveraging a CDN could save you over 75% of your server load and make it way faster. This course with show you how in a step by step guide. It’s way easier than you think.

What students are saying

This is another amazing course and whether you choose to take it as your first course and later like I did, the concepts and techniques you learn will be extremely valuable. Now I can feel confident in how I write my code. (Full review at https://bit.ly/2Y9YZL)
-- Roger T.

Source code and course GitHub repository

github.com/talkpython/fast-python-webapps-with-cdns

It's not just server-side Python performance that matters

Building a high performance Python web app requires many key elements. First you likely focus on your Python code and making the database fast. But on my web page requests, that Python HTML response is a small, although important, portion. It’s common to have 30, 40, 50, or more requests per page. In production, the frequent guidance is to host these behind nginx or similar server. Often that is enough. But by bringing a CDN into the mix to globally replicate and localize all those requests can seriously improve the perceived speed of your app for a global user-base. But did you know that these static resources can put a massive load on your server too? This course will give you a step by step guide with live code demos on how to incorporate a CDN (Bunny CND specifically) with a Flask application. You will also see the before and after performance stats from Talk Python’s web infrastructure from last year’s Black Friday week of traffic.

What will you learn?

In this course, you will:

  • See how CDNs work and interplay with your web application
  • Leverage the CDN to deliver globally-scaled, geo-replicated content
  • Use the CDN for your static content (images, css, javascript, etc.)
  • Avoid stale cache content while 100% caching static content on the CDN and clients
  • Host large, user-generated content (audio, video, documents, etc.)
  • Use storage zones to serve large content globally
  • Debug issues with CDN content at the CDN level, web app level, and browser level
  • Test user-percieved performance for your web app (full page loads, not just Python paths)
  • Replace Google fonts with GDPR / privacy friendly alternatives
  • And lots more

  • View the full course outline.

Who is this course for?

For anyone who has or is building a Python-based we application and wants the best experience for their users.

As for prerequisites, we assume:

  • Basic familiarity with the Python programming language and core tools (e.g. pip)
  • That you know how web applications work and are familiar with HTTP and HTML
  • We do use Flask, but you don't need a deep understanding of it to be successful

The tools chosen and featured during this course are 100% free and most of them are open source or have free and solid alternatives.

Concepts backed by concise visuals

While exploring a topic interactively with demos and live code is very engaging, it can lose 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 animation presenting the multiple levels of caching that add performance but also introduce cache staleness. We then go on to present several options for avoiding stale cache content entirely without sacrificing performance.

Example: Concepts backed by concise visuals

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.

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.

The time to act is now

For just a few dollars and hours of your time, you could be delivering your web app through an incredible global network of over 100 servers giving your (potentially) modest application the powerful infrastructure driving top tech companies such as Google, Soundcloud, and pretty much every other tech company that comes to mind. Join the course and get started today.

Course Outline: Chapters and Lectures

Welcome to the course
24:18
Welcome
1:58
What is a CDN?
3:07
More than one request
1:55
Not just optimizing server-side
5:26
Why I avoided a CDN
4:19
Tech stack for our app
2:58
What are we going to build?
3:33
Meet your instructor
1:02
Setup
5:41
Setup intro
0:50
Get the source
1:13
Installing Python 3
1:04
Editor choices
1:04
Bunny.net account
1:30
Integrating Static Content
49:17
Intro to static content
0:46
Running the demo app
7:28
Project code structure
3:36
Local is always fast
2:23
Running over ngrok
3:45
CDNs and pull zones
4:03
Creating the static content pull zone
10:25
First CDN url
2:32
The rest of the static links
5:11
Faster still with preconnect tag
4:27
Smaller images are still better
3:35
Be careful with private content
1:06
Large Content
26:27
Large content introduction
2:12
CDN object storage
1:49
How Talk Python uses storage
1:39
Where is our large content in the app?
2:15
Getting the large files
1:08
Creating the storage zone
3:25
Uploading files
4:02
Connecting and testing the CDN
2:51
Demo: User-generated content in app
7:06
Avoiding Stale Caches
29:22
Welcome to fresh caches
1:46
The caching problem
2:48
The caching fix
3:14
cache_id_builder
5:46
Demo: using cache_id_builder
8:22
Remember vary by in the CDN
1:17
Finishing the rest of the links
6:09
Troubleshooting
14:16
Troubleshooting introduction
0:56
Check the dev tools
1:04
Try without the CDN
2:51
Demo: Toggling CDN on and off for dev
4:21
The CDN keeps logs too
2:07
Purge the cache
2:57
Fonts
12:44
Fonts are tricky on the web
1:47
But it's an ad company
2:08
Bunny is not an ad company
1:51
What does API compatible mean?
1:26
Using Bunny fonts
5:32
Checking your work: Performance testing
16:21
Performance testing introduction
1:04
Testing with LightHouse
9:02
Testing with network tools
6:15
Course conclusion
5:29
Quick review and thanks
3:58
Remember the repo
0:27
Stay in touch
1:04
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