[Python Flask Tutorial] 2. Apache and Flask

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this video we are going to learn how to set up a patch and how to integrate python flash 3d let's get started with the root account we install a patch dnf installer http yes complete we change to the configuration directory c curve we copy the original configuration file to another for better purposes copy configuration file developer we edit the configuration file we comment out this line for security reasons httpd processes are not running yet ps minus f correct http we start a patch object control start now httpd processes are running let's check if your patch server is working properly http ip address of your instance okay the default test page appears the opacity server is running normally if your local browser cannot access the patch server in your instance please check the aws inbound rules open aws is to cancel and go to the security group as this rule to the inbound rules http port is open to all users we create a simple web page grab document root httpd.conf document root is www.html we open our test html file vi hello that html hello world it's a very simple web page we open a browser and access the test html file properly ip address slash hello.html [Music] okay it works we are going to install python flask with heist on three license plate is already stored python3 this is version its version is python 3.6.8 we install python flask ps3 install flask okay it's installed we create a simple flask web application we change directory to document root city viral www.html i test at the pi the source code is very simple import flask create a flask cap attach the route slash to the app index is a function corresponding to the route slash when a user accesses the app with a router slash in the browser index function is called and returns this string to the browser if the app is executed from the command line interface and then run the app with host 000 and debug mode true before running the app we must add an inbound rule open aws each to console go to the security group add the following inbound rule type is custom tcp protocol is tcp port is 5000 source is 0.0.0.0 we run the test set python3 tests the pi this is a development server to not use it in a production deployment the app is running on http colon slash flash if ip address colon 5000 5000 is the default port for flask in the development server 172 blah blah blah is a private ip address which is used in ternary we need to use a public ip address to access the app in our browser open a browser type the public ipod address 5 4 blah blah blah is a public ip address colon 5000 [Music] okay the test flask web application works and we can access it with browser this way of running the app is for development purposes only in production we use a production wsgi server instead a patch is a good wsgi server which can be used in production we are going to learn how to integrate python flask with a patch we need to install mode wsgi dnf installer python3 mode wsgi yes complete we modify the opens configuration file vi httpd.com we add the sgi module wsji script earlier tests www.html testdev.pi 7x in order to combine test setup pi with our patch we need to slightly modify test at dot pi vi test setup pi we add an else plot as application equal to f application variable is used in mode wsgi so do not change the variable name we restart a patch oppas control restart in production server port 5000 is no longer used slash test app [Music] okay the test flask web application works integrated with your patch in more detail we check the value of the value hover underscore underscore name underscore underscore in development server python 3 test set up high port 5000 is used and the value is underscore underscore main underscore underscore in production server port 5000 is no longer used slash test app [Music] the value is mode wsgi and some string test data pi is owned by root account it is not a good idea to use the root account in production service for security reasons we want to use normal easter user account in service to use the easter user account for services we need to configure some settings here is my assembly home is to user we add absolute permission for others to home easter user change mode o plus x home is the user execute permission is added we check the context yes ldg for www is the context is httpd this content t here is my cdz home issue to user the context is user from dirt we change the context of each to user to http change context minus t https content home is to user the context is changed we copy test data pi to home is to user copy var www.html text app.pi home is to user smart llc form is the user test sector pi the context of test setup i is automatically httpd this content t we change to root account we edit the apache configuration file vi etc httpd http we change the path of the task javascript to each user home is it to user in order for our pass to access these to user directory we need to add a directory configuration directory home is to user allow of write none options none require or granted we restart our patch of s control restart probably ip address so let's test them ok the app is running under the east user account not the root account the value of name is also changed we summarize this video we install a patch dnf install httpd we install python flask ps3 install flask to integrate python with our patch we install mode wsgi dnf install python3 mode wsbi we configure httpd.conf the real sgi script areas is set for python apps script we use east user account for services add execute permission for others change context type to httpd this content t add a directory tag for home east user thank you for watching this video
Info
Channel: coding in action
Views: 178
Rating: undefined out of 5
Keywords:
Id: Txe2RHED_GQ
Channel Id: undefined
Length: 17min 11sec (1031 seconds)
Published: Wed Jun 16 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.