Building Data-Driven Web Apps with Flask and SQLAlchemy Transcripts
Chapter: Deployment
Lecture: Setting up our code

Login or purchase this course to watch this video and the rest of the course contents.
0:00 We've got our server all ready to go. The next thing to do is to get our code on there and get everything set up like our requirements and so on.
0:08 Let's go over here and we're going to SSH back to the server and notice we have our virtual environment already activating itself, that's pretty sweet.
0:16 We're going to go into the apps directory and here we're going to clone our repo. So the command would be git clone, here's the URL.
0:24 But notice I'm going to put a different ending here so I don't have this great long file name in all of our paths. It'll make it a little easier
0:30 to fit it on the screen for you. You can do this or not do this. Now this is asking for my password 'cause during development this repo is private
0:39 but of course it'll be public if you've run this before you won't need a username and password. However you might for your personal stuff
0:45 maybe what you're creating is not open source for example training.talkpython.fm, not open source. So here we are, we've gotten our code here
0:55 we've seeded the app repo, what are we going to get? We're going to go here and see the app and if we go into Chapter 15 down here
1:08 here is our project that we're working with, so. We've got our server project that we want to copy over and we've got our regular app.
1:17 Now before we actually try to make it run inside my Nginx, you definitely want to make sure that just the simple case of it runs.
1:27 So, we're just going to try to run it right here. Now, if I ask which Python, it will have the right one because the virtual environment
1:34 but if I try to run this, it'll say No no, you can't run this because there's no flask. Well, first thing we've got to do is install our requirements.
1:43 And so far we've been using this one but now we're going to use our server one which has things like flask and SQLAlchemy
1:51 but not say the testing tools and other stuff a limbic for example, that we don't need here. Actually, we might want a limbic here, but anyway.
2:00 We're not going to install that for now. We're going to say pip install -r requirements.txt Just like that, it's all done.
2:09 Now, if we try to run it again look, it's running great. Now, let's open up another terminal. Come up here and let's just do http://localhost:5006
2:21 What port is it running on? 5006, let's give that a shot. Hey hey, that looks a whole lot like our little thing we built during the course, all right.
2:31 So, we got it working, that's great. We've got our virtual environment set up and it looks like it's working great over here.
2:38 The next step is to get this to run under. And then kind of work our way out of this onion layer of things. And we got the basic app working
2:46 then we get it working in. Then we get it working in Nginx and at that point we'll be good to go.


Talk Python's Mastodon Michael Kennedy's Mastodon