Deploy Django with Apache and mod_wsgi on Windows Server 2019

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so this is going to be a quick tutorial on how to deploy a jingle web app onto a Windows server using Apache and mod WSGI so the jingle project are we working with is this quick simple app has a form takes in some inputs and saves this data into a database that's basically it I currently have the project available on github plus the link in the description so you can download it but in order to deploy it I'm gonna first need to create a virtual machine so I'm going to be using the Google cloud platform and in order to create a server a window server I'm going to change the OS to windows server change this over to Windows Server 2008 Center and then hit select make sure you allow HTTP traffic and if you want you can adjust the size of machine but that's not really that important I mean it can't off because I actually have a VM that's already running I'm gonna close up this terminal that's not needed anymore and in order to access the VM all you need to do is download the RDP file and the RDP file will work on Windows and non windows-based machines like a boon to you you also need to set your password user and password all right so I'm gonna open up my VM that's already running here and before I can begin setting up the Django project in Apache I need to make a couple of set prerequisites so we see hit no internet options that security disable that custom level I'm gonna allow downloads yes privacy sites and that's just so that I can download a useful web browser you all right now that I have a around here that I can use I'm going to navigate to get bash and download get bash as well just make using the windows terminal a little easier you this isn't selling I'm gonna go and download Visual Studio code and the reason that I want to use Visual Studio is just are just any editor is just so that I can edit some quick called files next I'm going to navigate to close that out github.com and I need to locate the my files for the my project so I'm just going to do this the dumb boy just gonna find myself as a user look at my repositories and there's my web project cool I'm gonna copy the blank get bash it all those be done alright I am going to enough users and I'm going to open up get bash here and I'm just gonna call get loan link to my get repo hit enter alright so here's my project and on github I've outlined some steps that are needed in order to set up the project with Apache so the first thing that we need to do is install download and install Apache and we use the Apache Lounge at this drill so the first thing that you want to do is make sure you have these visual c++ binaries installed save agree install and then after that's installed you can download Apache now before I said patchy actually want to install a Visual Studio code to select all the options all right I'm gonna go to where Apache intelligent I'm going to extract that you want to copy this Apache t4 folder and paste it over to the C Drive all right so after copying the apache2 files you want to open up a terminal as administrator and you want to install the service so hit start typing CMD and run as administrator all right you can see that Apache insult without any errors and you can verify the installation was successful by starting the service if you open up Test Manager you should be able to see the service running running and you could also navigate to localhost and see this test message saying patch is working and close this tab out and I'm going to stop the service the next thing that is needed is to install the microsoft c++ build tools and you will definitely want to do this before you run pip install mod WSGI so I'm going to download this and this will take a few minutes to install you select C++ Bell tools and hit install the tools are installed you can just close out the window and close this table up close that out right the next thing we need to do is download it and install Python now although 3.8 3 is available I'm going to use that I'm going to use 377 right click and run as an administrator and we're going to use a custom installation and I'm going to edit the path so that it's just sitting right at the C Drive you want to disable of path limit and close that out all right so we have Python and salt and the next thing that I want to do is navigate to the project I'm going to open up the project with Visual Studio code and the reason for that is because I need to add a few things before the project can be deployed alright so in the install requirements I'm just going to delete W fast CGI that is for Microsoft is not Apache so don't install that so three things that you want install are Django over by Excel and by WSGI the next thing that you want to do is go over to your settings dot pi change the buck to false edit a lot host to be localhost or and your your VMs IP address for me that is this you can also add one two seven zero zero one and the last thing that you want to change is static route I'm going to open up a terminal and you can just do that by clicking on the address bar and it typing CMD then enter and I'm going to install my requirements once all libraries have been installed the next thing to do is let's see okay on any terminal you want to run mod WSGI Express module config so what that does it basically gives you some settings that you need to append to the become file for Apache so my WSGI Express and if you just type in - age for help but you can see that there are a couple options the one we want is module config great so copy these three lines load file load module and WSGI python home copy that open up the httpd.conf template and you want to replace those first three lines so those first three lines relate to python itself and raining lines relate to your project so all these paths they need to be updated with where the project is located so if I just go over here I can see that not try this I can see my path I'm gonna copy that and I'm just gonna go one-by-one editing each line in addition you also need to supply an IP address now if you're just running this on a VirtualBox VM your IP address will just be localhost otherwise it'll be the IP address of your virtual machine some go back to the Google console and copy the IP address paste that in there okay so I believe everything in here is updated so the next thing I need to do is go to see Apache T for call and I want to edit this httpd.conf I'll open it up with is a code and I'm just going to scroll all the way to the bottom and paste those settings in there okay so Apache should be configured the last thing that I think I need to do is just collect my static files okay okay all my CSS files have been copied over to the static directory you see I have my CSS for my main up the last thing that I need to do is start up the Apache service now I'm just going to verify that that is running you can see the Kara on the task manager we have a GT for running so I'm going to open up a tab navigate to localhost and you can see here that my web app is being served but the CSS isn't so let's go inspect that need to inspect the HTTP Cal file so just to verify this I'm going to navigate to this address see what it gives me alright so I'm in my CSS directory okay see there was a misspelling to tease right there so I'm gonna correct that don't eat that all right I'm gonna hit refresh on this and hopefully okay doesn't want to work actually what I need to do is restart the service okay open up a new tab cool so my web app is running as it is intended and everything seems to work here so the last thing that I want to do is adjust the firewall so that I can access it outside of this local VM got it inbound rules new role I'm going to change the port at 80 in there the name will be a World Wide Web allow access to the world all right I'm going to go back to apache you restart the service and now i'm going to minimize my VM now I'm on I'm on my actual machine I'm going to navigate to that IP address and hopefully we'll see our web up and there you go there here is our web up you can even see the last input in there which was be one two three and now I'm going to type in four five six so we have C four five six if we go back to our VM go to localhost you can verify C four five six all right so that's basically how to get a simple Django web up to work with Apache and mod WSGI on a Windows Server Thanks
Info
Channel: Johnnyboycurtis
Views: 17,272
Rating: undefined out of 5
Keywords: Django, Python, Web Server, Apache, mod_wsgi, Windows Server
Id: frEjX1DNSpc
Channel Id: undefined
Length: 24min 3sec (1443 seconds)
Published: Thu May 21 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.