Building Data-Driven Web Apps with Flask and SQLAlchemy Transcripts
Chapter: Deployment
Lecture: Concept: nginx

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Finally, we needed to setup Nginx as our external server that would internally speak to uWSGI. So here's how we started.
0:09 We said we're going to listen on port 80. Our domain is what we came up with. It was fake_pypi.talkPython.com.
0:15 You'll have a better domain, I'm sure, than that. But whatever your domain is, here's what it is you have to set that up in DNS.
0:21 And then we map the static files with caching and gzip and all that stuff over from where it is on the file system to /static
0:30 and we set the cache for 365 days or one year. All right, so this is the first part of the file. So this is the static stuff and listening.
0:38 We'll copy this file over to /etc/nginx/sites-enabled. And then, in addition to that we're going to have a location for / that's going to take the url
0:48 and try it against our application. Which is just to say pass all the right parameters over as well along to uWSGI.
0:57 And the way you get to it is through proxy_pass localhost:5000. That's it, we copy that file over we restart Nginx and off to the races.
1:07 We're ready to talk to that domain. Last thing we did was use Let's Encrypt which rewrote this file to listen on port 443
1:15 and do a dedirect from port 80 over to 433 so we have SSL as well.


Talk Python's Mastodon Michael Kennedy's Mastodon