#100DaysOfWeb in Python Transcripts
Chapter: Days 89-92: Deploying Python web apps to Linux
Lecture: Your turn: Deployment

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Now that you've seen me deploy one of our web applications, it's your turn your turn to deploy some app that you built during this course.
0:09 So, let's talk through what you're going to do during these four days. The first day, if you've made it this far by watching the videos, is done.
0:17 It's just going to be watch the videos. They're about an hour long that should pretty much take up your first day. And then the rest, I've broken
0:23 into three major pieces. On day two, what you're going to do is you're going to create the server and you can use DigitalOcean, Linode
0:30 Amazon Lightsail, or even a local VM. Here's some options: you can see, you get credit if you use these links these are from my podcasts
0:37 don't have to use them, but, you know why not get free credit if it's out there? The goal is to create an Ubuntu 18.04 server.
0:44 The version's kind of important because some of the commands won't work on older Ubuntus, things like that. What we're going to do is just
0:50 create the server on one of those hosts log in, patch it right away before it gets hacked and that's it.
0:57 Just create the server, make sure it's up running up to date, all those kinds of things. On the next day, we're going to get your site on the server.
1:05 We're going to get it running by itself and then running under uWSGI. If you're going to deploy the Bill Tracker
1:12 here's some information about exactly how to do that. If you're going to deploy something else you might have to tweak this a little bit, right
1:19 sort of a choose your own adventure if you go down that route. So here's the commands to basically get what you need
1:24 to run Python under uWSGI and Nginx on the server right, so we're also going to set up the firewall and also set up Git just so it's easier for you
1:32 to log in, access your reposts, things like that. Then you're going to set up the structure for the source code so, again, if you use the Bill Tracker
1:40 follow along exactly. If you don't use the Bill Tracker, you need to adjust this slightly, of course.
1:46 And then finally, here's the command to run our app under uWSGI. Okay, and this works for Pyramid for Bill Tracker, you have to tweak it differently
1:55 along with a description here, if you're going to run a Django app or a Flask app. And then finally, we're just going to enable uWSGI
2:03 to run as a daemon, that autostarts with our Linux machine. After this day, you should have your app running
2:11 at least internally, not exposed to the outside but running in a web server in uWSGI on Ubuntu. Last day is to put it on the internet using Nginx.
2:19 So we've already installed Nginx, previously and what we're going to do, is we're going to set up our website to be publicly-served on Nginx.
2:28 Follow along on these steps, if you can run this command in the end, with your virtual environment active so you have that command.
2:35 If you can run this command, and you get source code back HTML code back, you're probably good, otherwise
2:42 here's a little bit of help on how to track down some of the errors, check out the log files things like that.
2:47 And that's it. I hope you find deploying the Linux easy and a really cool way to host your web app.

Talk Python's Mastodon Michael Kennedy's Mastodon