Python Web Apps that Fly with CDNs Transcripts
Chapter: Integrating Static Content
Lecture: Running over ngrok

Login or purchase this course to watch this video and the rest of the course contents.
0:00 If you have Ngrok already, fantastic. Welcome to the club. If you don't, then go over to and you can download it here.
0:11 Just click download and you can install it with Homebrew or you can just download the Apple Silicon version. You can check out pricing.
0:23 You can see that it has this free tier which would be perfect for what you're doing. I actually have this paid one that allows me
0:29 to use more stable subdomains instead of, normally it just creates what's called an ephemeral or random domain and it'll just change every time.
0:39 So you kind of gotta, if you do this, either just leave it running or connect it, go back and update the connection at the CDN.
0:48 You'll see how to do that in a minute. So once you have it installed and set up, you can say ngrok HTTP and let's say 10001.
0:56 It's not our final command, but let's start here just to see. So what this is going to do is it's going to create this ephemeral random domain over
1:03 HTTPS, which is pretty excellent. And then if I click on this, it's going to loop over to local port 10001 and in PyCharm, I still have this running.
1:13 Okay, so it's hanging out down there. No connections yet. But if I click this, notice it's pretty slow. Look at it dragging along here.
1:24 But sure enough, our stuff's coming along. That's our web app. We can go over here and we could search for Apple.
1:33 And there are our results coming in slowly, which actually is really good because it's gonna give us a huge opportunity for speeding it up.
1:43 And you can see behind the scenes how it's pulling in some of these items. Okay, so we're gonna use ngrok to see how this can be nice and slow.
1:54 And I said this is not the final command I'm using because notice that number ends in E05. If I run it again, now it ends in 029
2:03 every time this changes. If you have a paid account, I recommend that you, let's call it, and talk is fine.
2:12 You can put a subdomain here and it'll create something. Now, as of two days ago, they just deprecated that, but I'm not sure how long it'll last.
2:22 There's some other features instead. There's a replacement feature instead that's a little more involved, but you should probably
2:28 be able to do this for a good long while. Anyway, I can now use this and it won't change from time to time when I run it.
2:36 Still takes a second for this to all come rolling in. There we go. We have our website on the internet temporarily until we shut down in Grok.
2:46 It's got a decent, somewhat slowish ping time. So we could come over here and say ping that. And look at that, it's about around 100 milliseconds,
2:57 which is slow enough that we can actually get, oh, look at that, it's bumping up for a few times.
3:02 It's slow enough that it'll give us some real benefits when we get to the CDN. It's not at all local. It's not just read that file over local loopback.
3:11 So in Grok, while we don't have to do much with it, we just set it up and point it at our website here,
3:17 and then we just use this for the rest of the time to get to our website, to feel the natural slowness of it, not the fast local version.
3:26 There's not a lot of effort to make this happen, but it's a really important aspect that allows us to avoid paying for server infrastructure,
3:35 setting up Linux, making sure we don't forget to turn that thing off, end up paying for it in the longterm, all those things, right?
3:42 Really nice and simple way for us to accomplish, what we're doing here.

Talk Python's Mastodon Michael Kennedy's Mastodon