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