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