Python Web Apps that Fly with CDNs Transcripts
Chapter: Integrating Static Content
Lecture: Local is always fast

Login or purchase this course to watch this video and the rest of the course contents.
0:00 When we just ran that app, I bet it felt super zippy and really fast. You know why?
0:06 Because local is always fast. It doesn't really get much faster than I need to download that image
0:13 So let me just read it right off of disk basically or run it over local loop back on the network. It's always fast and
0:20 We're not concerned about using a CDN to make local code fast
0:25 we're trying to use the CDN to make the stuff at the far edges of the globe compared to our
0:31 server but not our users, we wouldn't make that fast. And so we need to do something other than
0:37 run it locally in order to actually test that. Now we could go and set up an actual web server
0:44 topology in one of our data centers. We could create a virtual machine or use a platform as
0:49 as a service and say, well, here's Nginx and here's g unicorn or micro wsgi, and we're
0:55 going to do all the trouble to set that up and manage a server. Now we're not going to
1:00 do that I'm going to show you something that will actually simulate the same thing and
1:04 is kind of properly slow, but not so slow that it's terrible. It'll be great. So we're
1:09 going to use this thing called ngrok. ngrok if you have not heard of this is a super cool
1:15 tool. What it does is you run your code locally, you never ever put it on the internet. So
1:21 for example, notice up here that it says localhost colon 10001. That's where our code is running.
1:30 But what it does is it creates a reverse SSH tunnel back to our system and it puts that
1:35 on the internet at We can share that. So we're going to share that with
1:43 our CDN so it can get to the static resources and stuff that it needs to sort of begin the process of seeding the whole network with them.
1:52 But this is great if you're just working on a project and you're doing some kind of meeting
1:56 with a client or your team members, you say, "Hey, look at it running on my machine."
2:01 And instead of just screen sharing, you just give them that link and you let them explore it live and you can even debug it.
2:07 I've used this to debug API interaction with our Talk Python mobile app and our backend API. So really, really cool.
2:16 And we're gonna use ngrok for setting up a slower public interface to our web app.

Talk Python's Mastodon Michael Kennedy's Mastodon