Building Data-Driven Web Apps with Pyramid and SQLAlchemy Transcripts
Lecture: The setup script and config files
0:00 Now our server is set up.
0:01 Let's talk about the things that we have
0:04 to put in place for this to work.
0:06 We're going to need to install uWSGI and Nginx
0:09 but we're also going to need to provide a number
0:10 of configuration files to make this all work.
0:13 So, to that end let's jump back over here to PyPI Deploy
0:18 and that chapter in the Git repo
0:20 and I'm going to put a new folder here.
0:22 Instead of typing this out I'm just
0:24 going to show you 'cause there's tons
0:25 of detail that's just not important
0:27 you just have to do those steps.
0:30 So we're going to have an Nginx file
0:32 this is the configuration file for
0:34 well you guessed it, Nginx.
0:36 We have a service file, this is for
0:40 systemd, to manage the system service there.
0:42 This is going to control the process of uWSGI
0:47 the overall monitoring process here.
0:50 We're going to tell it to go and use
0:52 our production.ini, our production.ini
0:56 this has some more configuration settings for uWSGI.
0:58 Right, but this is like the system daemon
1:00 that's going to run, that's going to be the Python side of things.
1:04 We're going to do the same with Nginx
1:06 and this is listening for static files
1:08 and then just delegating the commands
1:10 off to uWSGI for the Python stuff.
1:12 And then finally we have our bash stuff here
1:15 and we're just going to run these commands.
1:16 We already did these two to make sure
1:18 our server is not super duper out of date.
1:20 And notice PyCharm says, oh we know about bash files
1:23 and we know about Nginx files
1:24 so let's do that real quick.
1:33 Here we go, now we have the little
1:34 syntax highlighting other help
1:36 and our bash, and same thing for Nginx.
1:39 Let's go ahead and commit these files
1:40 'cause one of the first things we're going to
1:41 do is go over here and do some git clone action
1:45 to get our files from here onto the server.
1:48 Let's make sure we're in sync with GitHub.
1:59 Okay, so everything's ready, what we're going to do
2:01 is I'm not going to flat out run this script
2:03 although technically you could.
2:05 I'm going to go through sort of block by block
2:08 and talk about what we're doing.
2:09 And some of those are going to move these two files
2:12 which if I've done everything right
2:13 I've configured the folders and everything to line up
2:17 long as I put these all together successfully
2:19 we should be able to just copy these
2:20 files in place, run a few script commands
2:23 and our server will be up and ready to go.