Transcripts
1. Introduction: Hello, guys. Welcome to our new course. Bite on flask for beginners. So this course is focused on building the applications using flask. This is a framework which helped us to develop the applications with minimum amount of work . So in this course, we're going to learn the operations, create, read, update and delete. So with these operations, we're going to develop a website that will help us toe navigate across on data website. I also do much more operations. All right, so what else we're going to do? We're going to focus more on the backing and less on the front end because we want to be able to do more operations. Because how it looks might be a second reading for us regarding this course. All right, so flask is most off her back and framework, it's not a friendly framework. So that's what we're going to focus for now. So what is the core structure? So the first thing is, we're going to learn what is internet? All right, we do have ah, vied, uh, area off definitions on board the internet ease. So we're going toe, get it street in the first part. All right. And The next thing is we're going to learn over, Installed by Tom and also the my script. This is a database a database administration system which will help us to save data received other update delete the data that we have used that we have been using for our Web application, and also we're going to run our very first flask application. Believe me, this is going to be exciting. And the next day, the basic structure of flask application, all of your developing applications, each off the application framework, kinds of basic structure that we can follow so that we don't have to beat ourselves how the brains things. So there is a basic structure that we can follow, and the next is we're going to use the ginger cool temperate engine so this temporary engine will be helpful in serving HTML pages. What are the static pages for our website? So this is a temporary engine. We're going to learn how to use it. The next year we're gonna add CSS was in Butch that while we have talked about flask being back and forever, Bootstrap is a friend and design framework, so we're going to use it to designer websites as well, but we're not going to be going deep into it because our present causes more focused on back in. But although we're focused on beckoned, we are going to focus a little bit about actually designer object, and the next is in degrading MySQL database. So this is a very, very crucial step because we're going to save data that has been received from the user and also goingto send data back to the user from more database. So this is a very important step, and it's going to be very easy, just a few lines of code. But it is very critical because figure it form, the entire system will get corrupted. So we need to pay attention in this lecture as well. We're going to on the next things. Hitch really Rewards and Status Court, So hitched it'd be is a term used in serving the pages across the Internet. They're going to learn about it so it has some basics. It has some basic status courts and some verbs indicating what is the response it digs in the record. The resulting request has been responded correctly. There are many status courts and many verbs. So we're going to look into some off them so that we can gain an understanding about the and the next days we're going to develop a sample project. So we're doing nothing but getting data from the user and saving it through the database. And you might as well retreat or no, but fasting is We're going to take data from the user and save it to the database. This is a very sample project which will help us toe understand the current operations. What are the crowd operations? Create, read, update and delete. All right, So what has were going toe prepare ourselves to believe a bigger application, then simply developing a sample project. So he disliked here. We're going to get ourselves together. All the resources that we need to build a bigger application. All the data that we need on the A resource is and much more. We're going to learn, forget and the final ease. We're going to develop a build a block. All right, here. This is a final project in this part of the course. We're goingto bring all the knowledge that we have learned from the beginning to the end of this coast on. We're going to develop and even be the project so that all the knowledge that we have gained and the skill that we have developed throughout the course, we'd be used for here so that we can actually developed a project that contest ourselves and bring our skill into real world. All right, um, although we're going toe learn a lot in this course, there are few prerequisites. All right, if you don't have any, we have already closes for them. All right? So first thing is, we need to have basics off fighter. We need to understand what are the variables? The data arrives. The syntax of the python code is written a very basic stuff. And then a basic knowledge of HTML in CS is so because we need the server pages, we need toe be able to write a little extreme. Although if you do not have any knowledge in distance, it's OK because we're not going to go deep into HTM instances. So if you have any doubt, do just referred to the Internet, Internet, and you can resolve any doubts that you have and the basic knowledge off my skill. But not mandatory because we're going to go through it in the course. So if you do not have any my school basic knowledge we're going to experience in the, uh course it's. And if you do not have any basics off fight on knowledge, you can refer to the coast fight on for absolute beginners that I have already developed it . All right, so you can refer to the course to learn it and come back here so that you can actually have a more good grip on discourse. All right, so with that in mind, So this is the introduction from our course, so let's get ahead.
2. What is Internet: Hello, guys. So now our topic is what is Internet? So we're going to learn how the Internet works and what exactly happens when we actually get to the using an Internet. So an Internet is a communications system between a client and a server for there to machines involved in using on Internet. All right, basically do and you can have multiple systems. Well, we're not bothered by how multiple systems communicate right now, but we're only going to concentrate on how to systems communicate when we are actually using Internet. So the one is climbed in. The 2nd 1 is severed so a client can be over browser and the severed could be an I P. Address. So we already know what about Bro's Aries? Because we're actually using a browser. You might have as well watching this course in on a Web browser. All right, what is an I p address? So an I P address is similar. Toe, Have you have an address for your home? All right. Whenever if I want to send a parcel to your I need to have the address to your home so that I can reach you in a similar way Every website has an I P address. So this is a basic understanding of how our water napi addresses. But we're going to look into more fundamentals off understanding what the I p addresses in a little bit. So are very bitter. Communication is a client makes a request to the server, and then the several responds to the request by sending some data. So what it could be. So if you observe here, the client makes a request What it is searching for www dot google dot com and the silver response, but sending it a Google home page. All right, so this is how a basically question response works. Okay, so what else we can do? So let's understand what an AP address. So a google dot com www dot google dot com is the domain page. So this domain name is what we're actually requesting on about Broza, right? So when we requested on my name, you see here the definition of idea Grace I p addresses the sequence off numbers. So it is easier for us to remember domain name rather than to remember an I P address. So what? What is the basic concept? here. What we're going to do is we're going to link the domain name to the I P address. So both of them actually means the same aggress. But since remembering names is much easier, the numbers we're going to use a dominantly All right, so every domain name is map it to an I P address. So the Internet service provider does the domain name system. Look up the map Dominion pie Progress. So basically, what happens here is whenever we search for www dot google dot com, the Internet service provider, make sure that whatever we search for using the browser, he will take the domain name and doesn't look up for that I p address matching the domain name. Whenever he looked, we met the I P addresses. Matched the request will be directed to die Progress in a similar way. How so? Let's go and look. So he reclined A server of a brother on an I p agrees. So whenever there is a request made, it will be sent to the I S P what is an SP Internet service provider? So he performs a DNS. Look up for I P address after its matched it will be sent to the I P address. What did we send the request? And after the several matches with the request, it will make some whatever operations that it has to be done. It will do every operations and then it will send a response. It could be an HTML page text on a major or any stars called Whatever it can be, the several will rest pone anything. Even it is a failure. It will send a filial response. All right, so this is a business how an Internet works. So if you wonder where are flask application is going to be sitting on, there is no question about it. We're going to make our flats capitulation on the several side because they're going to serve requests so hours it's an implication that is going to serve the user requests. So he obviously we're going to put it on the server side. So this is basically what how the Internet works. So the district we have got our fundamentals off how the Internet works great in them, so we know. So now we know how did it works? What is the process in world whenever request is made from the client side. And how the responses sent from the server side. What is an I S P? What is the DNS? What is an I p address? Everything we have cleared up. All right, so now is the time to actually go ahead. And Makesem, uh, really hands on experiments. So before that, what we're going to do in the next lecture? We're going to install Python, set up our development environment and go ahead from there. So let's meet the next lecture.
3. Install MySQL: Hello, guys. Welcome to this new course in this course you're learning. How could you stole my insecure and I've been respectful. You can go ahead and install example seven as well, which provides burned BHP and I was my escalate along with them. If you only want installed my screen, you can continue with the structure. So let's go to my escort website. Oh, yeah, And pickled my escort website and go to Don gloves. When you get down, goes there, the whole bunch of things appear to you, so don't mind anything and go to the Maya school community GPL dollars. This is the one where we need to go. So click on that. Yeah. Now we have come to the downloads page. So when you get here very important thing that you need to lease we are. Don't bring my skill as a server if we need to link it with our replication. So it must be a database Silver has. But so that is why we need to get this my skill Community seven. Go ahead and call. Yeah, When you get here, select the operating system that you need to do Microsoft videos and then you get here, you will see a different kinds of things, but these are not which told us the zip archives. So if you see you Windows extended, extended, don't interested. And this is installer. So pick on this. This is the page. Then we need to head some people want. Yeah, Now we have got here. Don't bring this to a little bit or 64 bit Work on anything but very important. Thing is, this is 18.6 and 3 98.9 Wait, right There are two different fights is because one is a Web community in sugar. The second is you stole a community. The difference is that community needs access to the Internet after this violent window noted. And while he's stalling. But this Mestalla, the 2nd 1 has already hungry all the pre necessary packages that are necessary for our my script. So that is the reason this file his work large is in the 1st 1 Obviously, after the complete process of installation bull of the files we get to the same size for right now we're running 2nd 1 You get here, Gasol, longing inside. Now I'm not in the mood off creating account. Because what I need to do is we need to You stole my scripts. So go ahead and know things. Just start my dollar. Yeah, Down Lord has started. So read into the donor is finished. - Just a few more minutes to finish the dongle. - Okay , the donor is finished. So now just click on it. It's going to open a five stolen and in school. Yes. Quick. Yes. Yeah. Now we need to start out. So now it is asking the set up. Right? Which type of sudden divinity Napoli fold several only find wonderful custom right now. We're only going to go down before it really is all the products. I need it for my school server climb the release of only temper or either on replying, which is not really use with price and right now developed different is the perfect one for our view. So big next is asking There are some parts, just my family. This will from you because I have already had my spill installation in my sister. I install it before. So this is a reason it squatting packer which I'm going to go anywhere. Yes. So is asking Mitch product that I need to use manual or this. So there's an issue so good run installation from each of you. - So accent and you stop read ended this installation progress is finished. It won't take much time. Sinister nation is completed. All right, if you do this part, this is the next after the part country, it's you make Morgan the bad comfort because I have already installed my school, and I'm uninstalling you Sure you are. So if you come here, it's cute. It will take some time to install all of these things, and these are very necessary for our project. So literate under all of this is missed old do they? Not much time, but big some a little kind. So wait until this thing finishes. Um, uh, yeah, uh uh, - there , - you know, But all right, the installation is complete. So right now, it next on come with product conflagration, you can see the server router and some samples and examples you need to get next, and these will be configured. Right now, we're only looking for stand along this injury become stressed. Er is not for us because it's a high availability is mentally used under production ways. Not so there. Practice projects are sample, brother. Standing on my skills. That was enough for its for good. Next on, leave all of these things as these and click next Because we don't want changing that. A strong password. The Rick Wender thing we're going to use. I'm going to set a passport. So you go ahead and also save some possible for this Did next your ***, I would be lying. This is okay. We will do next. Yeah, No good. Next and again. Need to sit in densities. And now it's good. You just things need to be computed more big. Much time. May be starting to some more than others. Yeah, you finished. So good. Finish and get next. Yeah, finish. Get next. And now we need in the high school here. And do chick action succeeded. I know he's running scripts. This is all about contributing your application off my skill. My skull is being confused on our system, right? - Yeah . Finish The particle in cultivation is completed. Now finish. This is the show for our my execution on issuing operations in what else? We have in strong. Yeah, there's a workbench, so if you want to use it as a bench partner, you can use it as well. Between this guy's a grafter intra fish, you see the Daphnis and place on my school. Where is the shell park? Which is a common land operation. All right, so I'm thinking that this is that so actually seen what chance is there? This is a MySQL commanding. So let's start our password that they're getting it. Yeah. No. Yeah. If you see, these are the databases that the present in our system, some of them have been created by me under and other things that would be far from my Askar sign, using whose project show deadens he's on the Germans. So stuff from users missing. These are some other things that you can do. Then you have my skill installed and you have a nice girl. Come on, let's So by using this, my school is completely installed. By using this, we can actually run my spittle and get with the project and do wonderful things in the next part of the lecture. We're actually going to language of these things and work on the desk, so let's get ahead
4. Install Python: Okay, So in this video, we're going to download and install Python. So this is the time where we're going to install pipe down from bite on 3.6 point five. So when the time you're watching Discourse, the installation division of this off there might be abated. You're fine. And village four point. Oh, or anything less than that. But until the major vision, the number three here changes your okay to use with that. So we're here? Don't know. Don't fight on 3.6 point five. So go ahead. And don't worry. If you get down here, we will get the files that we need. So I'm working on windows, so I'll be using this x 86 64 executable installer. So I'm don't during this fight. So before be install it. We need to take off wanting. So if you have only installed python on your computer, I recommend you to uninstall and reinstall it, using the method that I'm going to do in this video. So before you do anything like that installation, so please uninstall your python on your computer and follow along with me. You see, the fight on file has already been dollar it. It's not a very big cry. So once it's downloader, open the file. So here it is. So now we need to do something that is really very important. We need to check this ad fight on 3.62 buck. This is very, very important. So after taking this instead, off install now click, customize, installation and see where the people's checked or not. We always want to check, because people is the very useful to install some other necessary things and autumns angle itself. So make sure the pastry and these other things useful for you or not for our purpose. We're checking Python is gender knock and next. So when you come to this, this part of the installation it installed for all users because we want every user on our computer to be able to use python and then hitting store. Okay, the second most successful, all right after the set of was successful, we should be able to use python from anywhere on our computer, So let's get to the next list
5. Install VirtualEnv and run Flask app: Hello, guys. So now what we're going to do here is we're going toe create a virtual environment. So before we go ahead, I want Toe explained. The water is a virtual environment. So this right now what we're working on is a desktop. It run. So this in compacts is entire work inside our pieces. So if we want to work on a particular part of a project and we don't want it to be bothered by bottles, happens in the rest offer environment, we need to compartmentalize that individual part. All right, So, uh, if you take a real world example, if you're trying to build something, you don't want to build it in the living room because when you are trying to do something, you might cause some trouble with the surroundings. So that case, what we're going to the big on dry the ship it to the garage, are someplace that work or anything else. So, in a similar way, we're going to create a virtual environment which is a compartment inside of desktop environment, but it doesn't be bothered by it will not be bothered by that. The stop surroundings. So first we need install the software. So tried the command installed virtual and rapper that when this is for Windows, so it's going toe is giving me a peep warning, which it's not mandated for me to do so. This is equipment already satisfied because I have previously installed it. So it's showing that the requirements are decided that if you haven't install it, it's goingto do it's procedure. But you need not worry because it's going to take care of everything. So while this is being installed, let's wait for it to be done. So what we're going to do is, uh after this is installed, we're going to install flask right in here, You see? Now it says are requirement already satisfied and the installing successfully installed. All right, So it is also showing me a warning to upgrade my people. Assure me, child, do it leader right now, much more important. Thing is, we need toe create a virtual environment. Right now we have installed the software that install a package that's gonna help us to create and use of which men. Right? So what are we going to do? Is type just come in? M kay virtual end. And now really to name it. So what are we going to name it? Uh, a sample. Yeah, No, wait for the command to complete. So So after I have completed installing my virtual environment, I'm going to change the directory pad. The timing. Because I need to see whatever court that I'm writing. What about quarter that will be necessary for creating with our application. We're going to create a new directory in a new location. So right now I'm in my city territory, so I'm going to change it to the E. And then I'm going to create a new therapy with uncanny are the name of the relative will be sample. All right, so now I am going to shifted to sample. All right, so pleaded out. So here, I'm going to actually create more, which will in run me. So work on create and gave were chilled and which is m k means make. Now give it a name. I'm going to give the name which, with the father is saved. Okay? It says already exist. So let me remove and again make it. Uh so this is the command for moving. So now I'm going to make it again so that, uh, it's gonna take a little time. Yeah. Now it's completed. So if you want Oh, see all the virtual environments that you have created over time you can visit visit them by typing disc amid worker. So these are all the, uh, what we call the virtual in Romans that I have because I have good on different projects, including genuine flask. I do have multiple off them. But if you want to go inside a particular eventually in running what we're going to do, we're going to type, work on and then specify the virtual environment. Now, if you see we're inside, it are they chose here because why we're creating it. We have gotten out. So if you want to get out off the between environment, the stipe, the active it and you don't know. But if you want to go inside again, we're concept. All right, so this is how it works. So the main important thing is we need to run our basic first application. So what we're going to do here, we're going to install flask, So let's head our toe or red site flash. Uh, go to the project spark. So Ukraine stations way we have. Yeah, here is installed flask. So we're going to use it. And evidently, installation process finishes. All right? Yeah. Expecting everything. Downloading? Yeah, pretty much. Everything is done right by now. Yeah. Successfully start. So now our flash has been start. So let's go into our Adam. So what I'm going to do here is I'm going to creating you, fi. Sorry. Closing you. Fine. So it's doing wrong. Dependencies. You're Yeah. So what I'm going to say I'm going to write some code here. So before that, I'm going to save it. Uh, we're doing my new Samper, and I'm going to give the name app dot by my by people because it's a fight on fight and say All right, so now I have my sample folder, and my fight on file is inside the sample. So right, the court, that environment right now, it might not be were clear to you, but just follow it so that we can actually test whether set up has been successfully installed or not, because we want to test before we go further. All right. So just write what I'm about to write from flask Report last with a capital F. And then after equal class, last and inside the parents is double underscore. Name. Double underscore. And here we're going to create a route. So this route is going to Derek the request to this part. All right, so here we're going to put a new function. It might be called the index. All right, so here we're going to written a simple street. Hello, work. All right, so now what we're going to do is we need toe. Make sure that in front here, Dublin school named along the score equals two creations. Dublin's corn main double underscore colon. That app dot run. I'll say this thing and come back to our command line terminal. So what are we going to do here? We're going to run the application. So if you see what's in our path, only 15 What is it? Abduct part. So how do we run it? By tone? AP not by so flash comes with the development in Balad Development Server, which will help us to actually test. So this already stays here that morning. This is a development server. Do not use it in a production deployment. So this is only for development purposes. So our application is running. And this you are. All right. So let's go Intestinal. So if you observe 1 27 001 is similar to how we have described in the previous picture. What is it on? I'd be aggress along with the remaining. So what does the domain on name off This I P address is it is local host. So you can get a tight. This are you can also type of local host. So I'm coming here. I'm gonna go local host Colin 5000 because it says 5000 is export. So it's running now, so we need to get out result here. So let's local host. Yeah, we did Get out. Is it all right? It says hello. So right now, this court might not be clear to you, but just I understand that we have got the results. So are all the set up has been done very neatly and successful. So after dis lecture, we're going to actually get into the main part and we're also going to learn what this court actually means. So let's meet in the next picture
6. Understanding Flask app: Hi, guys. So the previous, like, just we have learned what? The eternities, How we're going to learn the flask framework and how to build applications using it. And we have also understood how to install the python language, kid. And also the my still software. We also made a sample run off our basic application using plastic. All right, but we haven't discussed how the court runs and how this thing works. All right, so now is the time to actually understand how this thing works. All right, so let's make good understanding off it. All right? So a basic thing Areas this after pie file is which the entire class complication is built . All right, this is the place where we actually, sir, the request made by the client already. Whenever client makes a request, it comes to the server already. There has to be some operations made on the requests. When I request arrives, all the operations are performed in this abhorred by file. All right, so whenever the request is handled, operations of dance, we returned a response. All right, so this is a place where we actually do all those things. All right, So let's go line by line direction. Understand how this abduct fire filed works. All right, so to begin, actually, we need to import the flask module from the from this flask package. All right, so whenever we actually imported, all right, we need to instance she ate it. All right, We have used any app you can. You're free to use whatever you want, because this is just a name for the instance that you're creating. All right, So I have used the, uh, ab, which is the conventional way of doing it. And also, by creating this instance, we need to give us a para meter, which is double underscore. Name double underscore. All right, so let's just come in this out for a while and let's look anything else that we have leftover. Yeah. What else? This part. All right, here. We're actually telling it that this double underscore name is double in the school main double underscore what actually happened to res. So this is telling, uh, the app that this is the main function. All right, this is the main part of the application that we're running right. The previous lecture, when we have actually may ran the command fight on have got pie. It actually runs from here. Why? Because it's the main part. So when you actually write this line, abduct run, this line will make sure that the flask application is running. So this is how everything works. All right, so right now, let's go ahead and run our application. So I'm here. What I'm going to do is run the application. If you can observe, I'm still in my which limit on me. I'm going to write at dot by, um, made for the sotu. Stopped. Yeah. No, that's always running. All right. Uh, so what I'm going to do is I'm coming here. I'm going to say, Wait, where can I access my application? Here it is. Running on hits to DP colon slash slash 1 $27.0.1 Colon fighters in All right, you've you Abdullah? This 1 $27. 001 is actually the I P address that we have discussed earlier. All right, when you actually run 1 27 dog 001 colon, 5000 fighters and is a port number. All right. The I P address has several ports which we can use and all the request for a certain application. Our server using some port while here. We're using 5000 and you actually run it. All right? Yeah. It is not fun. The requested your was not phone of the server. If you entered the urine manual, please check your spelling and crying. And why? Because when we have actually run this, uh, you are or whatever we can call it as the address. So this is the route you are. So if you can observe here, it says get slash. It's to DP size. Wondered one and four or four. All I get is the http verb And for four is the status court. So the hedge tpp it should be words and the status cords. We're going to discuss it in the next coming classes, while one thing we need to make sure that we understand is this slash This is the route off the server. All right. While we did not mention anything how to handle this route, we got this, not phone error. All right, if you come back. All right, let's see an example. If you actually go to google dot com, you see the entire Google page is being served for us. Why? Because Google has established some certain, uh, pats to actually handle it. So whenever we actually access the google dot com, it goes to the server and the server response it according to the question we have made while we haven't actually established any way to handle this route. So if you come down here, this is the place, a place where we actually worked on. All right, So what I'm going to do here is I'm going to remove this comment, right, Because we have actually made some route. So here we have a decorator. It is ended APP got road, and there is a forward slash. As I have already said, the forward slashes the route, and here we're actually handling. How do, uh, direct a certain request from the client, so every route must have function to handle it. So if you come in this out, this is the function Benin, because index and were returning hello world as a response to the client's request. So, after saving this, come back here. So I'm gonna throw the server. Uh, run it again. Yeah. Now it is running. If I come back here and refresh it now, I can see the result. Because I have established a way on how to actually handle this particular You are all right. Although, uh, we have stressed it again and again. So any time we actually make a change, we do not have to refresh it because there's a tiresome process. We're in a developmental process. You do not have to refresh it again and again. So what are we going to do here? Is debug equals to true when you actually give this perimeter and set it toe true value. Now, uh, let's screw this over on running again. Now, if you can see debug mode on restarting with stared debunkers active because deep, deep agrees active, We do not have to refresh the server whenever we make a change in the application. All right, now, let's just come here. If you refresh it, you can actually see the result. Yeah, a result is Hollywood. So it's working fine. Now come down here and I'm going to change this ass. Hello, geek. I'm going to see if this I'm coming here and refreshing it. You can see I do not have to stop the server and restarted again instead, off volatile. I just hit the refresh. All right, This is a complete explanation off how, actually, the plastic application has run in a previous lecture. We have performed it, but we did not go through it. So a last and final thing that we can actually discuss here is the port number 5000. So if you actually go to 5001 port number, you're gonna get this kind of error. Why? Because we're not handling any request to the sport. But we can actually set it because we have the freedom to choose the poor that were actually working on. So I'm coming a poor equal to 5001. Save this. But this time we have to change. Sorry. Restart the server. Why? Because instead of changing, any part of duplication were changing And second soffit. So now run the application. Yeah. Now, if you come here and refresh it now you can see that Answer. What? The response from the server. But the police fighters and one. Now, if you go back to the Port 5000 it actually says the country to the page because we have changed it by ourselves. All right, so this way we can actually handle whatever poured that we want to work on, right for my purpose. I'm not going to change the report. This is just for demonstration hookers, and I'm going to set it to 5000. All right, so let's one the summer again. Let's see how we're actually getting requests. Yeah, So everything looks fine. This is the complete understanding off out of the bag application using flasks works. And from this point on, we're going to learn how, actually going toe use templates inside fast application. Let's get ahead.
7. Using Templates in Application: Hello, guys. So in the previous lecture, we have discussed a lot about how their flask application works. And this lecture we're going to learn how they had templates to our flask application. So while we have some text being rendered on our applications webpage, this is not the ideal way to actually use it. All right? This is not the ideal way to represent any data that we have, and we need to serve the user. Returning strings is not the ideal way. So if you actually go ahead, right, click on Rakic on the webpage and if you can actually see um, Okay, there is no you paid Socso. What I'm going to do, is it control you and you can see the braid source here. What is it? Just saying the string. All right, but if you go to any flask are ah, that's your flask project. Yeah, if you come down here and if you actually write ticket and go to page source, you can see a big HTML page here. Do not be bothered about this because we are not gonna do something similar like this. This is very, very complex from the standard that we have right now in our course. All right, But just understand that there's a lot going on here, then just me a text being represented like this. Although the page actually has a lot off text in it, it is not being rendered that they we have done a little. All right, so we need some hissed email usage. So what are we going to do here is we're going to go back to replication. And if you see here, we're running the strength. So is shirt off the string? We can actually render its team ill cold. How can we do that? We can actually replace just here. So what I'm gonna do is I'm going to put the text between the heading tags. I'll save this. Come back here. Uh, yeah, the has been reloaded. Now, if you come here and refresh it, you can see the slight variation on how the text has being represented. Now, if you hit control and you now you can see some hitched email. Cool, but not exactly. The week has to be represented because this is just mere hitting tax, not dental hits, camel coat. One way. This is quite useful because we don't have toe go to the redundancy off writing the same hitch came in court again. But this is not the very have to do. All right, so let's certain back replication, so this can be done. Alright, we conserve our HTML code just by returning it. But to actually clutter our main several with all the extreme in court just in the main application is not a smart way to do it. So with this in mind, flask provides us with module named render complete. All right, so this template module can be used to render its demon pages alright, how we're going to use it. So what are we going to do? Is replace this with render underscore template, and we're going to specify what html page are we going to serve on. I'm going to say index dot html and I say this now we need to create this html page, so render underscore. Template will access all HTML treasures from a folder templates inside the route project to come back here, create a new folder, you know, the name templates. All right. And now inside it. Creating new file name index dot html All right, now we're in our HTML page. Now, let's write some hitch. Temple Court. So what I'm going to do is go. I hitched Emma, right? This is not the doctor. I pitched him away. All right, Just say html and now start writing html courts. All right, so here is all the all of it. So here what? We're going toe. I'm goingto given me introduction off it. Not the brief one. So all the extreme in court will be inside these hitch team attacks on the beginning and the ending age Diamondbacks. And the head part is about writing. Some metadata are representing any part of the brothers stuff. Anything Els not the body off, all right. And inside the body is we're all our data that we want to use it to watch our are, see or read or view or anything inside the body. So what are we going to do? Is I'm going to give it a title. My flask project. All right, inside the body. I'm going to give Hitch one and Teoh, they are using templates. All right, now, saying this team come back here. The okayed application is being saved. Now if you see here. Okay. The service running. Come back here. Now. Refresh it. Yeah, I know it works. It says we are using templates. And if you actually look for the paid source Yeah, we have the html document. So this is how we can actually render html pages. So this is actually working on the route side of the project. All right, so let's go in here and create another road Abdareh route, and say, Now, this one will go for about and they're about, and we will return. Rendering the school template and his team a period will be about dot html. So if you might wonder the function name and the hiss Tamalpais name must match. No, you can have your own page name, the whole functionally. I'm just creating with both same name because I don't want to have any confusion when you're beginner watching it. All right, so I'm coming back here creating new file about dotage. T Emma. All right, so I'm going to just copy all of this again here and instruct saying this. This is about pitch. Let me put the border cats about beach. I'll say this. Okay. Now, come back here. All right? This thing is going comer running. Yeah, very trying. Come back here and refresh it. The other piece. Me, sir, I go about Yeah, this is about Page. All right, so in this way, we can actually run. Ah, replication, which serve such Daemul pages. All right. Another thing that we need to mention here is if you observe about Paige and indexing create, both of them are completely similar. But I believe the text that is being view is changing. So there is a lot of redundancy involved. Work across 100 html pages. So in future, you're going to use Zinser template engine. All right. We have listened about in the introductory part of this course dinner. Completing then will help us to remove the redundancy and focus on the poor part there is actually necessary for us to do. We don't have to go to the redundant stuff. All right, so this were actually controlling this part of the course, and I hope you understand much off much off it. Hopefully we're going toe learn a lot. So let's meet in the next section. We're going to learn how to add images. The hedge trimmer pages
8. Serving Images: Hello, guys. So the previous lecture, we have learned how to serve its female pages as templates. All right, so in this lecture, we're going to learn how to actually show images in our website. So So our flask framework uses static as folder to actually store the images. And also from there, we can actually use them to be rendered on our HTML pages. All right, so flask use a static folder. Static is, in the sense, any images? CSS javascript. So the already has said that we don't focus on CSS and JavaScript in this course. So for that case, we're only going to focus on how to render images. So let's go here. The sample grew a new folder names static for a static and inside the static for lead, We can actually save images, so I already have this image here. So what I'm going to do is I'm going to got this one here. Come here. And this teacher. So I now have my picture inside the static folder off my project. So if I come down here, I can see actually here. All right. Here is the picture. All right. Looks nice. Right. So let's go ahead and use this one to actually be rendered on our kitchen page. So what I want to do is I want that it means to be rendered on my index page. So I'm coming here below this heading I'm going to write image SRC, which means source. Sorry. SRC is equal to so here. We actually need to make sure that the path he's better photo is located. So, for dead, what are we going to do? Is they're going to write some fight on flask court. All right for that, we need to use two double braces. And here we're going to write. You are underscore for open races. And here you need to satisfy the folder. What is it? Static. And now we need to say, What is the filing file in the score name? Sorry, my name is equal to here. We can actually, uh All right, let's let me change this name. I'm going to see it as forest. Yeah, so I'm going to say for rest dot jp g. All right. So what else we can do? Okay. We can actually, um, set the heightened Vic Tawfiq do. All right, So let's go ahead and do that. So come here. What I'm going to do, I'm going to give it hide. My height will be 50. And also I'm going to give Vit individually. Giusti. I think this is pretty much enough for us to go and render it. All right, So let's go ahead and do it. But I saved this thing. Come back. Every other service, running or not. Yeah, he's come back here. Refresh it and you can see the image. It All right. So let's just put it out here, okay? I'm going to give it as 700 on. This will be my 100. Save it. Come back here. Fresh it. Okay? I must actually change this wonder beforehand. Great. This one to be so hungry. So come back here. Fresh it? Yeah. Now it's pretty much a little life. All right. From this way, we can actually server hitch lemon, Uh, with images. All right, that's the most interesting part. All right, what else we can do? We can actually use this You, Errol, for All right. You can actually see this is written inside the double curly braces because we want to separate the hitched email court from the fight on court that we have actually than inside the hits table page. All right, so what are we going to do here? Is you can actually use this. You are in for inside are abducted by file for vote to actually, uh, create or generate yours. So what I'm going to do is and where the import you are underscore for. And I'm going to use this to actually generate your so for what? We're actually generating around. So I'm gonna do generally euro for this function. So let's just get rid off this for now. So what I'm going to write is return. You are all underscore for and inside it. Just piss five. Which functionaries about All right, so now save this thing. Okay. Come back here. A severus now running back here and fresh. You can see the Urals being shown so we can actually use this you world to go back to the about page. So what I'm going to do here is I'm going to put another module. Redirect. Yeah. Read added, I'm going to use it here. Read, addict and inside. We're gonna put the perimeter as you are underscored for about. Now. Come back here. Okay, Now it's running. Yeah. And now, if you're a fresh it, we have gone to the about page. You can see the Ural here. All right. In this way, we can actually use the Ural Underscore for for both your serving in majors and as well as generally, euros. All right. So far, we have learned a lot. All right, We have run our basic application. They understood that the flask cordis on how it runs we have rendered hitch Tamil using templates were also sold. Html the images. We have set up our templates and static folders and what else we have done. They have looking to how we can use your other on the scope for two ways we can actually serve. Images on driven. Always generate yours. All right. We have learned a lot of stuff, all right, but in the next part is with a key component arrives. What is it we're going to learn about Ginger do template into So without any delay, let's get ahead
9. Using Jinja2 Template Engine: Hello, guys. The previous like that. We have learned how to render and image in their hitched family court. But this lecture is conta greater on ginger toe employed engine. So what are we going to do here is we're actually going to pass the data from the application to the HTML page on. We're going to use it. So for demonstration proposal, you're going to write some hardcore here. So what I'm going to raise I'm going to remove everything inside the body. Say, come back here and fresh. They go to the root if I see here. Wait. What I'm going to do is come back here. Remove this. The thing that we have done previously not save this. Okay? And if you would hear how everything is empty because we have removed everything from our body part inside the index strategy. So what are we going to do here is we're going to write code that is gonna produce some less standard, and it is viewed on a HTML page. So come down here on. I wanted to give each list item here, So what it will be is apple orange, and here it will be mangled save the same. Come back here. Refresh it. Now you can see in order at least actually show some data about the fruits that this is visible because we have hard quality. But in a real world scenario, that is not how you want to do. Because you do not know how many items air prison inside the, uh, data. All right. How many items are present inside? Era is variable. So you can the type court for every single that item that you want to be shown inside. You ventured, so they must be a dynamic approach or how to show it. All right, so what I'm going to do here is we're going to actually show this thing or a website, but not by writing like this. So what we're going to do is so we have some data here. So what I'm going to say is, fruits equal dough. I'm going to put it inside. List apple, orange and mango. Now, save this thing. So we have our data in the application part with a list, and the listening is fruits. So now we want to pass this variable to our HTML pages. What are we going to do so Come down here and say fruit equal do fruits toward change. Does this break? So on the right hand side, the fruit indicate the list right on the left hand side. Foods indicates the variable that we're going to use inside the hits team a page. All right, so now here. What we're going to do is come back here. Uh, assuming all of this and say fruits, go back here and refresh it. Now you can actually see the list in the hits Dimmer page. All right, so this is how we can actually pass that African application part to the HTML part. But we don't want our data to be presented in a list for me. We don't. We want to see them individually. So what we're going to do here is we're going to run a loop around, so I would want to do so. There is a facility so we can actually write some pie. Concorde inside. HTM apart. So previously, when we have used double braces and inside it, we have placed our variable fruits. So whenever we want to use a variable inside, each team will pitch. We used this double races. All right, so now what we're going to do is we're going to write on statements off Python. So how that's going to happen. So open our curly brace and now use the person date symbol. And now you can write Python court for huh? Item and fruit. And now end be the person hated symbol. So now you see the difference. Whenever you want to write a statement off fight on inside HTM Page, you're gonna use the curly braces and a personalization, but every day want to use a variable, You're gonna use it with the double braces. All right, Now you can identify the difference. So now, here, instead of fruits, were going to use the variable item. This is so similar to write a fight on court. So how do we actually know when the Philip is going to end? All right, there is a small statement that we have to write, but before that, I'm going to clear it out. So whenever you write code and fight on language, you use indentation to know when the block of statement end. But here we do not follow any inundation because this is a html court and just we're going to embed python courting, so we need to make sure that you understand where it's going to end. So come down here now. Again. Another fight on statement inside this. Now we go to write, and for now, this will end awful. So come back here. Refresh it. Now you can see individual items, but okay, These air shown sequential and hearts underway, but these are not visible in a list for me. All right, So if you want to show them in and actually previous the have you done using on order list so we can come down here? So what I'm going to do is I'm going to put all of this in. Okay, so inside this you are a list. So Hungary closed on our list here, so all the items are actually placed inside a lie. What is it? It's still a state right now. If you actually go ahead and refresh this page now, you can see them in in another list for me. All right. This way, we can actually use for Luke along with Python and his team in court. So the stuff that we have done what? Using python language inside HTML code is what assume that to temperate engine is useful for. So now that we have used for you, let's go ahead and use if conditions so we can use if condition here. So what I'm going to do is, uh, similar to operate quite uncertain, because if statements also python statements, so open it and caused it. So if, uh, what are we going to say if, uh, mango and fruit, then we're going to say everybody say mangoes years list. All right, I'll save this. And again, we need toe right to the end. If state may well see this thing, Come back here, fresh it. Now you can see the mango reason list because we have a mango in our foods lifts. All right, So another thing that we can do here is what if we do not have Manu in our list? It's come back here just for if we do not have any item. So come back here. So what I'm going to do is I'm going to write an else statement as and here What in one degrees, give a paragraph. Mango is smart. The list, right? See, of the same. Come back here fresh it now. Man was not in the list because we cannot see any mango here. All right, so we do not have to read any handles because if else is a part of life statement, they can use it. Are we? Do not, But and if it isn't mandatory, All right. So this is how you can use for a lift statement inside the hitched in record with the help off gender to Kampala. Jinja. Alright. Center toe template in. All right. In the next lecture, we're gonna actually learned some interesting stuff, so let's get ahead.
10. Base Layout: Hey, guys, in this lecture, we're going to learn how toe, uh, producer redundancy there is caused in our project. All right, so now we have to hitch temer pages, neck storage, family, and about got hitched. I've changed the body part for, so that each one of them look same lag, but resulting very less complex data. If you see riches Index, if I go about page, it has about that's it. So it is very less complex. But if you see both of them, there is very little change off data. The only difference is they have different messages inside the body parts. So what we're going to do is we're going to reduce the presidency by creating in HTML pages . That is the best layer that sells has a base layer for both of them. So from dead, the these vegetable pages can inherit all the messy, all the cold that is not being redundant. So let's do something here. What I'm going to do is I'm going to create a new template, come down, create a new template. I'm gonna call this base dot html. Let's just copy the court from here. Next copied is come back here? Yeah, just based it. So now let's change this to base. Yeah. And just remove the court from the index and about courage. December. So what I'm going to do is I would extend this system will present a board of this. So water murder is and would write a little statement on which the genes are temporal engine. Uh, bite on statements. Come in handy for here. We're going to use a new statement. What is it, Extends? Yeah. No, After this, we need to provide the html page name based dot html said this thing and just copy the same thing into the about dot each time a page. Okay, now, let's go here. Now refresh it. You can see base. All right. Now, if you do the peds source, you can see the same court. All right? Now, if you go to a boat, you can see the base again because both off them in heard the same html page. So you start off showing the same message because this is off. No use. If you can't modify, what data be a showing. So what are we going to do? Is we're going to create a block from there, we can actually inherit it and modify it. So create here, block. And then then give the name off the block. It can be anything that as you wish. I woulda said body. And then here, right and block. I'll save this thing. Come back here. Now, After extending this, what we're going to say here is we're going to begin, like, block body. And here we were, right and block. All right, so here, what I'm going to do is I'm going to see, uh, this is And next page said, this number copied this thing. Come back here and each other off and x. I want to say about Siri it. So after this, you can come back here. Now, if you're a fresh and you can see Index, this is in experience. And if you say about I want justice is about beach. So how is this going toe affected? So whenever you create a block here, if you use it in the place where we have extended this best British female, we have extended it here so we can use the block body property to actually bring this message into this part So now if you actually go here in the camp aids so you can see the entire court is inherited from based on HTML. But here, instructing block body, we're going to see the message that has been replaced. Bite. All right, so in this area. So in this area, we're going to see the message off this or this According to the U R. Let me have requested it. In this way, we can actually handle Virgin Nancy to reduce the redundancy and also make our court much more easier. All right, in this very can, actually isn't that true template engine to reduce it and and see the next video? You're gonna lend something interesting as but so let's get to the next lecture.
11. Adding CSS to your Project: hi goes in this lecture, we're going to learn how to style of webpages. So in that process, we're gonna use bootstrap. All right, so we're going to introduce CSS here. What issues is CSS is defined as cascading style sheets, which means styling our webpages, using that language. All right. In that process, we can also use bootstrap, So let's get introduced with that. So to use bootstrap, we need to install it. So we do have a special package by provided by flash has to use it. It's called flask. Bootstrap. So let's go ahead and install it. So before that, go to the terminal and come out off it. Close the server. Now. What I'm going to do here is people install flask, dash, bootstrap, after you for the command. It's gonna install all the dependencies required for it. Yeah, it's collecting. Downloading? Yeah. Requirement Chinese fired, everything having Yeah, I think it's almost finished. Yeah. Now the installation is finished. So what we can do here is we can actually imported from from flask. Underscore. Bootstrap import. Bootstrap. Yeah. All right. So after you import this, what we're going to do here is we're going to actually stand. Shit. The bootstrap. Come back here. Bootstrap. Inside a pants. Since you passed the app, that's it for this where we have actually Stan sheeted the bootstrap. All right, so let's go ahead and check whether how this works. All right? So I'm going to create a new, uh, route. So this will be CSS now, give it a definitions, he says, and this will return. Render on the score template, and this will be C s. A storage, Damn it. So now come back here creating a new file CSS dotage, Yemen. And after coming here, what we're going to release the butcher that we have actually important has some extra abilities like it provides its own base dotage daemul file So we can actually use it. So I'm coming here. So fried extends. Bootstrap smash based dot html already is gonna provide a new business which limit for us. So now what we're going to do here is we're going to use blocks. All right? Now, if you come back here, you can see, actually blocks provided about the flask Bootstrapped Margit. So there are different drugs that we can actually use. All right, so what I'm going to use here is I'm going to use content because this is the one that's inside the bodies. All right? I can have the use body s all for now. I'm going to his body. So come back to the come here on a block body and below this end block. And now you can actually write whatever you want here. So what I'm going to do is I'm going to put it. Sh one CSS. Now save this thing. Yeah. Now go ahead and run your application. It is vying. Come back here. Fresh it. And now go do CSS. You see, it shows us in a different text text for me. All right? This is because we have implemented it using bootstrap. All right, so what else we can do? We can actually add some buttons to it. So let's go ahead and remove this thing. So what I'm going to do is I'm actually going to add button type. You call the burden, and I want to put the name as button as well. So say this thing. So this is not going to refresh as if we have done previously because bootstrap doesn't get refreshed, even the put, Even though we said debugging called Corinna Replication e V have kept debugging called group. But bootstrap, He's working with another model. So we need to stop this over. And then again, we started so that we have all of changes inside our project. So come back here. And now, if you refresh it, you can actually see the button here. All right, But this is not so good looking. Why? Because we haven't made it in the starting. We just kept the bottom so we can actually use Bootstrap, the stylist. But so if you go the w three schools dot com bootstrap, we have so many classes that are here that we can use. So I'm going to buttons and you see there some defiled wants read these we can actually use . So what I'm going to do is and we'll actually use a primary one. So what did say it says dog obedience s primary here is the one. So I'm going to copy this text. Come back to my A project. Go to see his dotage. Tamil. What? I'm going to seize. I'm going to pass this thing. I'll save it. Come back here. Stop this. Ever refreshing. Yes. Now come back here. Go back here of absurd and the first listing. Now you can see the bottom has been started. All right, In this way, we can actually style our website. This is Ah, major. Granted, because we don't have to actually go toe all the critical stuff while designing. Because Bush stop has laid out very, very, very easy for me. We just happening on put the boot shop and even used the classes, whatever you want. All right, these much easier than we can actually writing our court. All right, so what else we got? All right, so we have actually used it, but, uh, we are index knowledge. Deimel on our Border Ridge team will actually use the based on reaching from here. All right, so what are we going to do here? Is we're gonna actually import the base bootstraps. Last base storage stemming from here. And then we're going to use this based on each table for our purpose. So from here, I'm actually copying this line. Come back here. In short of all this, I'm going to paste it. Yeah. Now what? I'm going to do is I can actually go. Go back here. You see, we do have multiple blocks, so I can use title to actually change it, So Ah, come back here. I'm going toe look title and then and lock. So I'm going toe. See this one as my project. See if this thing come back here, I stopped. Just learned. Run it again. Now, if you go here and if you actually Yeah, now you can see the my project about here. This way we can use it. Now let's change something else. So we need a vato, actually design the body parts. So this has content here, so we can actually put everything that we need here. Right? So come back here so below this I'm going to say block, contend. And here, let's say and block. All right, so But our index storage Tamil and everything is written in bodies. So here I'm going to give another block which will use those body blocks to actually get the data here. See if this and here every index dot in, uh what else? The about on each team member, you get the data. So close this one, It again Yeah, I'll go back here and not refresh it. All right? We did not see any changes here, so wait, let's see the pain source. So it says this is indexed. Butch. That's it. So I think we missed some change here, So let's go back and do it. So now let's make some change here and see whether it's applied on the main page or not. So what I'm going to do is I'm going to bring some jumbo across, all right? You don't have to know it, but just see, they changes are not. So I'm gonna copy this and paste it here. I'll say this saying, stop this ever running to gain it will restart. Yeah. So now, if you refresh it, yeah, you can actually see this. So this is how you can actually use bootstrap? I know you haven't been a little quicker, but you can actually learn the land about this if you actually go to the wt school to go home and, uh, just do some practice to use. All right? You don't have to worry about entire design stuff because in this course were actually more focused on the back in desperate all right. That is the main goal that we want to learn skins on the back inside. So this is a little demonstration of how they're going to style of pages. So with that in mind, let's get ahead.
12. Intro to MySQL: Hey, guys, in this lecture ever going to learn the purpose of database, why we had to use it and how can tell uses. So let's dive in, all right, The purpose off databases to actually stood there. So when you actually are a client and you make a request to the server, let it be called the gym ills. You send some email and password while you tend to get yourself into Gmail account. All right, When you actually requested the data has been sent to the server, the server actually has a database that actually stores the password An email off yours. So it makes some requests. If it's just the data, make sure that it matches with the data. If it doesn't make it failed, start indication. If it matched, it will be a success. So then the survival responded. Whether it is a success or a failure, this is the process off how their databases useful in a real world scenario. All right, if we do not have a database, what is the part of actually saving data? What is the point of actually having an application that can actually authenticate it? Because we need to know the email and password beforehand, while the user or the client actually wants to log that purpose. We actually use data bees. All right, so the structure of her Larrabees, Right. While we are discussing about escalate database, there are multiple types of them. There s krill, my Skrill, and different kinds of databases that are being There's a modern technology that's being adapted by many, many technological companies. But right now, we're only focused on this field database because this is the most primary one. A very, very basic one. Understanding, if you see, had this block is Archila caller database. Because we are moving into a pictorial representation. So whenever you want toe, use the database, you create a table. There are multiple tables, read the list and gonna pretend so right now, we have good deals here, and the fields are inside the table. So these fields actually hold the data. It is our rules inside the table. All right, Now you can understand that Field 12 are all columns and each off the and each death row is the one a called a record. So there are some questions that can be applied on Ah, the data entered Arabic. So how to, actually, if you want to created Adam is use the command, create database, and then the name off the database that you want to create. All right. So if you want toe actually use the database, then you actually get to the database using use on the name of the database. So creating just creates the database. So you're not actually holy just gritty, but But you want to actually make some operations, Honey, you want to get it as a current database. So then he performing use operation, and then what I going to do? You go to create tables inside the database. So the command is create table the name of the table and then actually spits Find the feels in the data type and the, uh what the size off the data today. All right, here we're using the field user at the school name, which holds the data of the usually, and then it is the type off their car, which means we can actually store next data, all right, and then a size 30 because we want to store data. There is up to the limit off 30 not longer than that. And drown another operations insect. Well, okay, we have created our database. We create our tables, we created what feels, But what is the data? We have the format, Custodio that are not the dead. So here concerns a command. We can actually insert data into that tables. So this is the command insert in tow, the table, him and the feeling name. And then we're gonna pass some values. And next is the retrieve value. Okay, we have stored the data, but whenever we want to actually see the debt of what is there, we actually retrieve it. Using the Celica while here. We actually using star here, select star from user, which means we're actually grabbing all the data inside the record. So starting to get all the data. But if you want to have particular data, you can actually use it to, all right? If you want to delete a value he said the leg from the table name, they're So if you want to delete a particular like record, use a bear claws, and then specify the user name so that the use of record will be deleted from the table all right. There are a whole bunch of other kinds of crosses they can use, but right now, these are only the basic commands. There's an update command as well. We're gonna see it. Practically. So what are we going to do now? Is actually opened the my school client. So let's go ahead and open it. So come to your desktop and open my skill command line flight. All right. Now, after opening this, whatever going to do here is we're going to enter the password, so type your passport that you have actually used toe install this. Yeah. And after this, what are we going to do here is we're going to create the database. All right? So create database, and I'm gonna call it as mine. The score that a base? Yeah. Now we want to use use, uh, data. My underscore. Dead of this. Yeah. So now let's create the table. Create table user with the user school. Name is it's feel with having worker as it's type and size off 30 right now in Great. This must created Yeah. All right. Now we have created our table. Now we need to instant data into the table. So let's go ahead and say, insert into user, user the score name. And now values. What is the value? Uh, Peter? Yeah. Okay. Now, let's add in another name. I'm going to say, Jack. Yeah, this works. If you want to view the data, you can say select star from user. And here it is, Peter and Jack. We have two rolls into set. All right, So if you want to update anything I have said about the object command, you can go ahead into update. User said user in the score name equal toe. What I'm going to say, John there, user in the school name equal to Jack. All right, Now it's from the command, and you can go to select start from users. Now, the Jack has been updated with zone. All right, so in this way, we can actually see. Now you can see it. Peter and John. So, in this way, we can actually make sure that update has been performed in a good way. All right, so if you want to delete anything, you can go out and said believed, uh uh, you if you want to delete everything, let's say D itself from Use it. Wait, um, he chose throws an error. So let's just write something else. Deal. It, uh, user delete from user. Okay, V did it from user there. I mean, user underscore name equal toe. Peter. Now on the command. Now it's run the queries. OK, so now let's go ahead. And Fitch, the data inside the database. So sex are from user? Yeah. Now the Peter has been deleted, and you only have John. All right, so this is how we can actually perform commands to actually manifest the data. Read the data, stored the data. Did the data lead there? We have seen a whole bunch off. This is a major part of the application process, that rebuilding because database is a very, very critical aspect of the A project because we are gonna play around with data. Right. So make sure that the experiment a little bit go around into the Internet fit, study some things, and we can continue with the next lecture. Thank you.
13. Integrate MySQL to Flask: So now what we're going to do is we're going to implement the integration off my school database along with the flask application. So to do that, we have a model provided with plastic. So we need in solid to come here. Stop December and right this comment. Great installed flask. Death. My skill DB. Now this thing is going to stop. Yeah, that's it. It's installing. Yeah. Now it's free. So now let's come here. What? Everyone do this. We're going to go to the team from flash. Underscore my skill. Maybe more, my sq. Uh, yeah. So after actually installing this getting get this my school, make sure that you're to the right people. So know what we're going to do is need to configure the database along with their class complications. How to do that? We need to actually set some credentials. So this this command. So what we're going to do here is say app, dog con fig. My I ask you on the score host. All right, so we're going to do a bunch of them all together. Yeah, so don't worry. We need to change it. So this will be user and this would be passed for, and this will be my skin Him. Okay, this doesn't actually make sense because they're not set training. You need to actually set them toe some values. But you're not actually giving That is right away here, because that's gonna cause some security issues. So what we're going to do is we're going to credit you file to come down here. You've got So what, are we going to this Demi God? Yeah, Reid, not cats. And here we're going to actually give the values. So the 1st 1 will be my Ask your on the score host, because to great, this is the color. You could be local host. Then my SQL underscore user will be that is route. And then my skill on the score password you need You need to send this to pass with that you have given. But you're actually starting to my scare and my still on the score D b will be my underscored database that we have action used to create it. All right, so, after doing this guilt of my application here now, innit? Import the DB documents filed here and use the values that we have given their but for their venue, this passion. Ah, packet. What is that? Import? Yeah. All right. So after doing this, what we're going to do here is get values from Yeah, Lord, and then open the file. What is the DB brought? Yeah, but make this what we need to install the package. I am so going installed anyway. Yeah, Yeah, it's gonna collect the packages. Yeah, don't worry. Even the police installation? Yeah, it's good. Come down here. So whatever going to do is be be my SQL underscore coast. Yeah, this is a copy, Syria. And now you should, of course, this user and then password on then again with David. All right. Not the single work buddies. But before that, what we need to do is minute in stan shirt the my skill, the pay of guard so that my skill equal my skill equipped through my desk. Your oh, well service team. Okay, So what else we can do? We can actually, up from some operations here, so let's go ahead and do that. But what we're going to do is we're going to get the index, but instead of all of these things, whatever going to do is more this times boozing anymore, but okay, So to make any changes to the database community use cursors. Carson is the very actually perform operations so un would create a custom of my stuff connection. God, cause. And then so you are not execute on down user in user values and person s. And here we want to see Mike. All right, so this thing that actually not work, but I'm going to explain why, So here you're going to say to your no connection Dark coming. So this single executed but comical actually performed the changes to the database. So let's run this. This thing will actually make given error. But let's find out why. Why Don by Yeah, Now go to your server under crust dispute. Now you can. I could see there that's been called. Why? Because not all again are not all arguments converted, you're invites comedy. What happened? Because, as we said, person says here it will take only the first letter and in short, off all mine. If you don't believe it, let's run this without office. Sanders, It's starting. Come back here on out. Assist you. You can see this state. All right, so to make sure that we have actually matching, just come back here and see. Now you can see the one letter that is I'm here. How have actually changed The court could actually fit our needs. So ensure sending it is a couple. Send it as Mike inside list service thing. Come back here. Right. Let's go here. Fresh it. Yeah. Now you're on this. You can actually see my kids. So this is a view actually inserted. So let's dough. Some changes that will help us to actually fits the data. All right, so let's perform something. Uh, I'm going to receive the data and presented. So although we have finishing all of this coming just coming this hour. So what I'm going to do is I'm going to I need discussing, by the way. So I'm used discussion. So here, uh, what I need to do is I'm gonna execute a command here this exactly, because this for now, execute on the command will be select star from use it. All right. So when you actually use the word select in the command, it was you present some visits, so distort them. We'll use results. All right, now we micro home How many values are inside everything So performed operations. Oh, we can, actually, with the misinterpret with actually having less visible. And they might not get any easier. So since is greater than zero, then give users equal Does you are dark, Fitch. All this will make sure that all the values inside Kushner be excellent. So here it runs the command. Introduce a number off records that are a thing. And this will condemn the number off the courts. When you actually make this statement were it will check whether there actually any records inside the results. So if it is granted, Angela, it means the results have actually some data. So then we're going to fetch the data to use us. So what we're gonna do is we're going to just bring them here. Users alright? Still see the same come back here U s issued right. We have actually closed this thing mafia. We might not see any result because we have given it in cream. All right, now, you don't see the result here right now. You can see the result here. All right, so it's tough finding it here. Let's do something so that you can see there isn't over there. So written. Uses all zero. All right? Yeah. I'm back here fishing. Right. What's that for? Um, usually must not for you, but cost. Probably. Let's see what happened. Um, she'll not sure the shirt. Sure. Um why? It's so that's finding out. All right, you just put it zero here way, start everything. I'll come back here. Yeah, there is. It is here. So in this way, we can actually use my skills taken save later. This store data and everything that we need to do there you can play around with it. All right. So just experiment with the database and crimes crowd some different things and that you can actually get good hands on the therapist stuff. So with that in mind, let's get to the next
14. Http Verbs: Hi, guys. In this lecture, we're going to learn about Hitch to debut works. So there are mainly two kinds of work. What are they? It's truly beget and its study proposed. Although there are similar type of words like another uh, particular use like put patch delete. But those are not for discussion right now because we're more focused than how toe perform operations like craving and changing. Some data are posting some data. So we're called concentrated on history, beget and actually proposed for right now. So let's discuss them. So the very 1st 1 is that should get. So why do we use it? It is used to retrieve data. Whenever you want to view some data that is stored on the server, use history get to serve a purpose, all right. And but one problem with this is gritty strings and as the part of the Europe. All right, so if you want to log in our register as a user, you will provide a password. So if you if the developer on the replication side users get request, your password will be visible on the You're like this, and it is not a neat way to actually use it because this poses security issues. All right, So how actually get request is you perform? There's a client, and the client makes that question so And then the silver reads data from the database and gives the response in this way by reading the deadline, sending the data to the claim dates treated. Get your questions before the second is has truly proposed. So actually, before city did used to change the state of the server. Alright. Which means we're gonna take some data and we're gonna change some part of the database to match our own data. And this is much more secure than get request because the Christian gets send the body of the question of the You are. All right. So how this is Burkes, the client center request to the server and the server with teens, the spirit of the database. And then it will respond to the climb. Right in this way, we can actually make things work, other guys. So let's make some changes so that we can actually work with, uh, website so that we can understand. How do we owe make get and post requests work for us. All right. So I'm heading over to here. I'm gonna delete this part. So what I'm going to do here is, uh I'm going to create a song. All right. A form like this. Yeah. So now inside this, I'm going to give a new input type for it and put and the type will be password, and the name will build password. Password. Okay, so now we're going to give it to submit and good and type is equal to submit. Yeah, service thing if you save the stool and opened this terminal. Great. You already do have turned and lying. Yeah, from the server. Now come back to your beach and refreshing. Wait, What? It does say bookshops are based on html not working, so we need to change. Um Ah. Okay. This is a problem. They change these things. Yeah. Save it. Uh, stop this over running game. Yeah. Now refresh it. So here we've got the form that we have Ah, work for All right. So what are we going to do? Is we're going to give some data today, so I'm giving a some down, a few submitted. You can actually see the password. Actually, being shown here, So this is not a secure way. But this is how they get two questions work. All right, so now let's going change something so that we can actually match. See how the ah, how the poster. Christie's works. All right, so come down here. Go go into the farm class and say method equals to post. Yeah, no sand, Justine. Now, if you come back here and refresh it on Did this thing go to the root? And now, if you said Matt did not allow the matter is not a lot further question here. Why? Because all the medicine, the flag from work, good for the get request. Because they by default, they accept get request. But if you want to make them work for your post acquis unit distance fight, so cannot hear common methods. It was cool. And now satisfy it. Get coma pushed. All right, now this thing must work. So come down here. Appreciate. Ah, right. It's every Stop running it again. Fresh it. Now I'm coming here. You see? Now the notice things work. Fine. All right. But we don't know what they say they're not, but the request is handled find because we have said to handle the post request. All right, So if we have said that the post request actually handles query string in the border of the request, not in the you are. So let's go ahead and see what's the body of the request. So we have variable that can actually help us to do this. So come back here and import the request. All right, so after doing that, come back here. If request dot metter equals toe post, then you can actually say every time. Um, we just creation is success fully. Duck. Yeah. Say of this thing, uh, this over. Come back, David, say, And now let's go ahead. And you the password. Now you concede registration. Successfully done thing, actually books, But let's go down and see whether we get the data or not. So what I wear to do is return the rest. Dordt, uh, wrong. And our name is password. And I'm going to come in this hour. Now say this thing Come back here and what we're going to do given to repress it, right? Yeah. Now e submit, You can actually see the password here because? Well, said to actually show the passport. So we've got it. All right. This is a very easy way to actually do things so well handled. Get request the post request how they actually see the data. And if requested, middle equal supposed. This will verify by the The question is post or not. All right, this way, we're gonna actually handle data and make sure that we get a request specified to get our posts. So let's get ahead in the next video we're going to learn about. It's really pissed status courts.
15. HTTP Status Codes: Hey, guys, in this lecture, we're going to learn about the hitch to DP status courts. So what are started school? So every time you make a request, what it get? Put post delete anything. The service since the start of school, which represents what kind off response it has been done. All right, so there are some There are multiple star scores, but all of them are categorized into five parts on how can we learn about them? So here are there. So the court that anything starts with one is information and anything that starts with to its success. Any court that starts with three is a redirection request. And anything that starts with four is a client. Error in anything which starts with five is a server, alright. And the last to the client error. And several can be handled using on the handler provided by the flask. But everything else is from some kind of information success and redirection from the server. All right, so what else we can learn from them, All right. There are some status courts that are very, very common in every living replication processes using the Internet. So learn about that All right, so here and there. So the status could 200 indicates the server is saying okay and do not one is created, which means some kind off information has been created. Are you can say a database to the court has been created 30 to its some kind of phone between your search firms have searched for some data and you have family. The court 400 is a bad requests, which is like in the previous Victoria seem so if you, ah, make a post request on a method that hasn't been allowed to make a post request, you get bad requests. Four of one is another rise. So you access some page on the website, which you are not allowed to access unless you log into the website that isn't are not raised for a four is not found, which means you try to access of repeat that hasn't been existing in the Internet or else on the service side. Then it is called a Not for four or five is a method not allowed. All right, 500 is an Internet star, but this is the server that is caused on the server side all right, We don't have a deal, but much with it. But it is a server editor which has to be handled by the very application developer. All right, so these are some important status courts that air that we seem to, uh, come across in daily application development process. So with this in mind, let's go ahead and learn about how to actually use them. How to identify what kind of request that we're getting. So let's get ahead into the practical side or this part of the application is what we have their loved, and we're actually learning about the database. So here, what we're going to do is we're under axis the cursor, and we're going to fit some data and we go to print the data, what, the first year in our database. So let's go ahead and do that. So let's go back. Terminal server is running. Go back here. And if you're fresh air, you can see there. Is it all right now come back here to the terminal, You can actually see the 200. This is what the request actually sends as a status code because we've got the request that were performed. It says 200. All right, so let's modify our cord so that we're gonna actually match something else so that we can actually get, um as we can see, another request being handed. So here is my server. My culture is ready. So I'm going to execute some quotes. You are not execute. And inside it, I'm going to say, insert into user and the field will be user name. And here values. And he everyone is supposed No, let's just say I'm going. Teoh put something like, uh, what else you could say for the name? Um, that's a Richard. All right, now, after this come down here, Wait. We need to give us a colon. And now say my school door connection dot Commit all right, after this outs, every turn and give it a success message. And also we can send the court that we want to about so by this, we're gonna learn where kind of status court discerning. Run this over and come back here in the fresh air you can see, such as being saying. And if you come down here, you can actually do a one being sent, right? So in this way. You can actually say that That our request has been in, uh, performed as we want. All right. So in this manner, we can get remind what kindof Sarah's courts are being sent. All right, so if you actually go and say, uh, access the about page, it's gonna send not phone because we have no about matter being handled. Know about root access. All right, so what are we going to do here is we're going to actually make sure that we handle these kinds of errors, As I have said, flashed, provide some error handling. So at AB guard, ever handler. Oh, 44 And now say death. Pidge North found and ease the message that we're actually getting in the Brazil right now . So now we're going to replace it with this. This beach was not fall. Save this thing, Maki are fresh air. Yeah. I mean, if you come back here and refresh it, you can see the message that reaction to this plane so we can actually handle what May says we can show on the pages does not exist. All right, so this way we can actually learn about started school, so we can get your mind. What? What has actually happened on the server side of the client? Eight. Whatever has occurred, how to handle another how to actually make sure that everything that is being performed in the communication aspect of the client and server is under our control. All right, this is a major thing that you need to learn. Because if you want to learn about how toe developed ABS, Web abs in particular and you're gonna actually handle the service side, you need to know about the status quo to last. Http. Votes right. So with that in mind, let's get to the next lecture.
16. Sample Project: guys in this lecture, we're going to create a new project in which we're going to develop a sample product which does them placed around trees and shows them that's that's house and abilities. So just to say, we're going to actually collaborate all the skills that we have learned until now and make a complete product by combining all of them if you're here reading the new project sample best project have been all the setting sail Saturday. Everything similar to how you have done for the previous strictures. I've done everything. Just that I haven't given any route grow taxes and any medicine to handle, right? So before we do anything, we need to set up a database because we need to say that they're so open your command. Like, fine. And here I'm gonna do the password. Yeah, And now what I'm going to do is I'm going to create a Galvis, create that a beers and hear the name of the dead of this. Yeah. Now we need to use the rest of this. Yeah, on now. Let's just create a table. Create demon Floyd on this score. That's a sport. What happens? Reported name 20 comma and it will be in Asia. Yeah, it works some. Now, let's see the lessons from this commands Star from Floyd if you want to know. So we do have a table set up right now. So what we're going to do here is come back here. So everything they set up. But one thing you have to I wonder the nannies You need to change the my SQL. And it's called Living Inside the Baby Camel match what we have done here, you need to change the my SQL and Scotty B to match the employee table. The database that will create all right, after doing that, your good to go now, The main important thing is we need to create a template right inside this. You do have a base template, but we're going to create a new bond index door teach to you and inside it. We're going to create what you're going to create our forms. That is gonna help us to take some data from all users. So come back here. So right extends these dotage and now yes, see a body. So knock body and lock. And here we're going to see farm Yeah, inside it. Give what? What we're going to get in. What? Hi. Because toe text name equals toe name. I copied this and create do you get off. But here, living. See that itch? All right, so let's give some label street then. This is gonna see age Sam Disdain. After saving it, we need to give a bottom so that they can actually submitted. So in good. My people submit. Yeah, sell this thing after saying it would be good to go, but come down here. We need to actually give something that is going to handle the requests. All right, so let's give it a lot. Abdullah Ground, This is the best car here, Dear Index. Now see what we're going to say. We're going to actually recount the index dark, great food, wood, and run your app. Come back here and see if you can actually see. No, you can actually see them. Ok? It is an adult here. Oh, go ahead. Okay. Mistake. No. Serious. Yeah. Now everything. You exclude. All right to come back here now, if they actually save this thing, we need to actually handle the data that is coming to our website. So when they're actually sending some that, we need to give it a course. Metal? Yeah, how? It's complete. So come down here. We need to make sure this one hand is the post Matters methods equal. Do get coma Post. All right, After doing this, we need to come down here if, uh, regressed. God matter equals two course Now what we're going to say form equals toe request phone way . Haven't important. Yeah, no quest that form now. Name equals to a phone or name on, then age old school farm off age. After doing this, my skill about connection not cursed after this. Now they're going to execute. They are cute. Ploy here. We're gonna user not used Name, comma age. Yeah, values. And here displayed values Name coma H. After doing this now, come down and come into the changes that were actually coming. Now I think everything looks fine. Talk. Come down here. Run your application. Using my time at the pie. Come down here, fishy. Now what? I'm going to say John and aged 25 submit days. I'll come back here. Just come on. You can actually see the data that is being saved. All right, This is a nice way to actually. Good. All right, so after saving the data, we need a day to actually view the data. So let's go ahead and do that part that you want to do. All right, So come down here. Now What? We're going to Dewey's given a given your out. Like so I want to say ABT brought out and law these bloodies. And now with that said DEA years and then we're gonna say you are culture my SQL dark connection dog cursor. Now we can use this cursor to actually get Britain's results equals to see you are not execute. And here, we're gonna see said Star from Fly He And then if the results are greater than zero between , we do have something in our records, then we're gonna get grabbed. The music will. You are not h on. And then Britain render the score template. I'll say we're gonna actually give some next to your mother. Okay? Implies because employees now they passed the death. So we need to create this template. So I'm down here and blow use Nottage. This will be a lot he started so come down here. Give it. Yeah, I say this. Come back here. Now. What we're going to do is they don't actually gives him that up, so we need to show the data. So how are they going to first extends this blockage demon? And now Law, Body and Doc. Now let's write a table table. We just want to have the border equals one. And now we're gonna run a look for item in employees. Let's just end the four before the right in court. Inside this, we're going to ride. Yeah. And inside this, each dead item will be I am all zero. And I say this thing, Come back, run the application. And if you go back to the website if you say it No, You late? Yeah. Okay. Okay. Now we need to have this. This thing must be inside double braces. So you just come back here, Freshii. Now, the data is actually all right. So this way we can actually see their time. We can actually cuter. But this doesn't have to be, actually, in a way. Now we have done it. So? So we can actually specify how we can actually get the data. All right, so come back in to the dark. I grew up in the consideration. We can specify something that's con fig. And now my skill underscore Curse of class. This is gonna specify how we're actually getting the girl from this Christmas, the terrorists. So Dick Course is gonna change the data that we're getting into a dictionary format. So now come here. Insured off zero and all vacant space without name. And we can remove this and say I got H. Now come back here on this, uh, go back to the speech. Yeah. No, this is if you come back here, Teoh. Helen really go. 70 days. No law. Years. You can see. All right. This is a basic quick to understand that what they have done until now can be collaborated and made a card. So in the next week, next lecture. Whether learns on essentials on how to actually implement a product that's going that has a scope more than this. All right, full. Let's get ahead.
17. Flask Sessions: Hey, guys. So this is a new lecture before we actually may go into developing a big project, we need to learn some key. Keating's All right, So this concept is sessions. So what are self sessions? So sessions store some data, so depending on the time off, the user in correction with the website. So if you if you speak about an example like if digs emit, so to do any operations email, mostly you need a password and you need user authentication media right. To access the inbox toe, read an email toe, send an email to delete and discard in a draft that you already have in the email, you need to have a user authentication for it. All right, so But every time you actually do their operation, you don't actually give any password or is the name for that? You only do it one time by because the session variables store your details so that you don't have to do it multiple times. And even if it asks multiple times, it makes gives the several much load back to you. Deal. So in this session. So this class, we're going to learn about decisions so How do you actually? So just wanting imports session packed module here. And what are we going to do? Is we're going to use decision here. So what are we going to do in a session? Is we're going toe show the post user first using in that we have. So come down here se session and give it a name using man. And what I'm gonna do is I'm going to bring out the first employee zero. And what is it? It's the name. All right, so here we have decision, uh, set to the user name. I wanna show it in. The one key thing is, when Once you set the session here, you can use it anywhere. You back. All right. But setting it here because the council will get the data from here, But you can actually use it any way you want. So what I'm gonna do is I'm gonna copy this. Get to the index dot html on. I'm going to use it here. All right. Just money. I need to put it inside. Zinser conflict format. All right. So what else we need to do? We need to set the secret key vibe. because session variables hold the cuticle data there off the user for So if you don't set a secret que anybody who access about side of has basic knowledge on how to hack, we'll eventually get the data. So you need to set a secret key. And, Ansel, one thing is importantly, the secret he must be somewhat difficult to guess. All right, what I will do is I've got confidence, and it is a secret on the school key. So to make it tough to guess, what I'm gonna do is I'm going to import. Oh, yes. Sorry and good. Oh, yes. And I'm going to use this with dot You random off 24. So this will help me to get a random string. All right, so let's check it out. What happens? So I'm actually going to run this over by Don't buy. I'm going here. So first we need to go to a local slash and place for the decision. Variable is set because we have written in the on price part. I'm refreshing it. Yeah. So what I'm gonna do is I'm going to go. Yeah, now you can see the first string is said John. This way we can actually set session variables and use it for our use. All right. Session variables are key for a website minutes because you need to deal with the Lord off stuff that the user performs. All right. Whenever he exit to some data, whether he pushed some data, you need to have user authentication performed for some kind of operations on your website . To do all of them, you need to set sessions. Unless we have a server that doesn't do much of book but handling user data. Right? Thank you. Let's get to the next level.
18. Handling Sensititve data: the guys. So now that we're learned how toe handle session data. So we need to learn something else that is much more important with along with sessions. What is it handling since the data? Why? Because in this case, we're handling just name and age, whatever. What if the user actually gives us some sense through data like password? Are any credit card information anything like that? So he's trusting his much more sense to data along with you. All right, so he's giving it to you, so you need to be very careful about it. All right? So even though you might be the most harness person in the warm, you might not do anything wrong with this data. But still you have. You are in the threat of being hacked by somebody who is a Swiss with a bad person. All right, so with that in mind, we need to take extra measures. All right, So what are you going to do? Here is we're going toe has the password. Whatever. We're getting so for that purpose. What are we going to do? Is we're going to change this name part, but actually giving it a password kind of you. So what I'm gonna do is I'm going to say password. I'm seeing this name password as well. Yeah, I'm not gonna change this part of the name because I have to change at multiple locations, so But that come back here and actually taking this out because I don't need this anymore. Now I say this come back to abduct pie. So now we need to import something that is necessary for hashing it. So let's dough. Okay. Frown. Just type. This is to pronounce is much more difficult for zero dart security import. Now generate password hatch dysfunction will build for us, too. Gender, The password hash. So what we're doing here is we're gonna actually taking name. So, like, so we're actually naming it as name, but it is actually the password. That's so what we need to do is, before he actually saved in the database, we need to generate a hash worry. All right, so let's come here. So I'm gonna say name equal. Do generate password hash off name. All right, now say this. So now we're confident that our name ever passed. What is actually seeing the different kind of thing. All right, so before do that before we doing that, come back here. You see their tomb names, actually, with different kind off. Sorry. Two names with actually a similar kind of text way have given it. It's bringing that. So let's just come in this thing for a while and let's check it again. So what I'm going to do here is fresh. Okay? Come back here. Go to your terminal on your application. Come back here. Yeah. What I'm going to do is I'm gonna do actually give it as, um What? I'm gonna leave it. Us something like this. Yeah, that's admitted. Come back here on a few. Action is selling. Yeah, it's I said Friday. It's stored as friday. Know somebody hacks this thing. It's very little chicken here. So after after using this function here, let's go to our Broza and years, something like this and say agent 20. Now, if you actually go here and still it's stuff you can see, this is a much more Lindy a string and more confusion string because we have hashed our password. So this is much more difficult and sometimes impossible, depending on the person who is trying to hack your down this to crack this hashed passport . All right, so no, uh, when you actually have this password in your database, if the user wants to log in and uses his passport, what we're going to do is in decrypt this passport. What you have done of is encrypting the password that he has given you. And you have to decrypt it and take whether the user has entered the right pass without knots. So to do that, what we're going to raise, we're going to use another function similar to generate password hash. We're going to use chick, password, password, hash. Yeah, this function. So we're going to use this function. Come down. Go. Uh, maybe we need to go. Okay. So what we're going to raise on? Sure, if all the session and everything that's just read this and we're going to say we're going to return something, Rita, and use this function chick password, hash. And the 1st 1 will be the password that you're trying to get. So this one is the 4th 1 So it must be 3012 and three. So chick past with hash employees or three and available is name and coma. The one that we have actually gives. Send it. So before sending it, we need to actually take cast this thing. I see this thing Come back here in Europe. Come back here. Now if you actually go to employees. Yeah, you can see. True, because that's what we have entered it. All right, if you even change a single letter dissented. Standing two cats. So if I come back here and refreshing is gonna show falls to me because that's not the password. So this is a very you have to start passports if you want to steal sensitive data, anything creep, card, information, passed, words, anything that you know that it's since dio for the user, you know, just hash it, all right?
19. Adding NavBar: Hey, guys. So this, like job we're going to discuss about how toe given navigation bar for a website. So any website that you actually go and visit has a navigation, but by default, right? So if you go out into, um, say Facebook, you see, when you actually go to the page, Uh, this is also some kind of a navigation bar, but this is a not a good example. So what I'm going to do is go below calm. You see, this is not showing the right one, not home. Yeah, if you see this is a navigation, but it doesn't seem like there's a bar, but you can see there is a Jeep veto Gmail images, some kind off another abs signing. It is providing options to actually navigate. So we're gonna copy navigation bar code from here and use it in our data on our project. So we're gonna actually show some navigation, but so what are the vitamin need to go to navigation? But because every time we want to goto, Rupert said, we don't want to do this. And every time we want to see her and price, we don't want to pay all the where the you are. All right. So, by the way, we need to change this spot. So I'm not here and moving this, and I'm also getting rid of this. All right, so this seems a little bit odd because we're actually okay. We're gonna actually change this to on We don't need this either. Yeah, okay. That sounds that actually cool. Okay, so meaning is we can actually put out navigation by here, so let's go ahead and do that. So I'm going here. I'm gonna copy this navigation called. Copy this. Good. Back to deposit. I'm gonna create a new file. This When we called nab our I'm putting an underscore before it. You scorn about Rh terminal, and I'm copping this. I say this thing. So what I'm going to do is I'm goingto bring the bootstrap again here. So mine is already said. Yeah, So gotta be a storage Tamil and short off all of this. What I'm going to say is on word extends. Hey, uh, it would be books, crab slash bass got html. All right, so after this, we need to do lock, title and and block. And here you need also given block content on this will basically end block. So why don't they just copy? This carpet is accommodate. Yeah. So here. What I'm going to do is I'm actually going to give a subcontinent from here the part of the court that everything other pages will come down. Yeah, So you can actually use this and were advised dot html. So? So while we have changed everything now what we need to do is, uh go, come here. And we're gonna include a number here when I say include actually including it. Look, bar on. Sorry. And look. And here, we're going to set up when you say include the part of the code will come. And just pacer here. Include on a score now. Bardot html I think this is pretty much powerful. Let's close to stain. Yes, every hear everything you say. Come back here. Yeah, Service trying. Now goto here and refresh it. Okay. Chase and picking our farm. Which subsets? Html. Okay, so we haven't changed it here. So there is some kind of her that is upper. So what is it? Okay. We have you know, a typo here. This is would strap save it. Come back here and finish it. Okay. Now we can actually see the, uh, this part. So let's go and modify some part of the nab our sign. Come here. I'm going to say form project. I don't need these things. Okay. I want that one home on this one will be employees. So it with slash law years, genius years. Yeah. I can actually remove these boards. I can see it. Uh, yeah, that's it. Pretty much back here. Fresh air. I can see the phone project home. Yeah, employees. You can see that this one is we have discussed about This is the hash key. So this way we can actually show that we don't actually going to yours like that. All right, so this is pretty much told me we can use the navigation bar with that in mind. Let's get to the next picture.
20. Flash Messages: Hey, guys, this lecture, We're gonna learn about a flash messages. So what are they? So before we learn about flash, Mr Just Why? Actually, we need them. So whenever you actually send data to the server, like if you go ahead and say I'm gonna say Jews and then I'm gonna say some 20 and submitted. There is no message. That is indicated there are several has been successfully submitted. Toe the several. All right, Just please have the form that we have filled before. That's it. We don't know anything else if your user particularly. All right. So for that, we can actually introduce flash messages. So what I'm gonna do is I'm gonna come back here, and I'm gonna make some changes to our court that will help us toe grab some flash messages . So come down here and flash. And what I'm gonna do is I'm gonna come down here, right where after I commit this changes on myself slash the message will be successfully submitted. Yeah, that's will be my message. So not what I need to do is I'm going to my base. You're hitched whenever the data is successfully submitted inside the content What I'm gonna do is I'm gonna show some message so it will be right distance this one. The knowing would use some, uh, labels with my sage is equal to get on the school flash. So I flashed underscore messages. Yeah, inside this. What are we going to say? We want to say end with and with and inside When I say you, if we have any messages and if so, here, we're going to actually show the messages. So he ever whenever in a for loop, for message in massagers. So after being the for loop, whatever I say is I'm gonna and for and here we're not sure these items. So he didn't want to say message. Yeah, that's it. I say this thing, uh, chick with us ever is running or not. That is running. Come back here. So now what I'm gonna do is I'm going to see, um j and for Yeah, okay. There is no This is being shown twice, so Oh, the surgeon. We have already every step that we need to do for now. Let's get some data. So I'm review There's now it says successfully submitted, but, uh, there is Also some problem if we send some, uh, wrong data, what we're going to do then. So if I say something like, uh, Jack and I'm going to see this, um, fixed, it must gets a matter not like this. All right, so we need to handle that case. So for that, what we're going to do here is get back to our cold and go to application. So put this entire thing inside of try block. All right? Come down here. Try and didn't die at the scene. Yeah, And here we're going to see it. Except and here flash, uh, seen toe submit. Sort of the same. Come back. Your application this season ending? Yeah. Now, if you said Medio okay, the certain might have stopped growing. Yeah, but in arts, running back here accurately restored. Squish it. It's gonna say file to submit because the dad is inconsistent. The data type insider database. All right, but we can make this miss just much more than kept reading by actually adding some color. Great. So if you come down here and, uh, alerts, you see, there are different kinds of alert messages based on the intensity off or their importance so we can actually use it. So what I'm gonna do is locate. This one is success, and this one is dangerous s okay. I'm gonna use this. Thinks so. Let's go, toe. Go back to accord. And along with this, I want to pass a message. I want to say success. How long would this I'm gonna see it? Danger. All right. See this? We're back to our best or HTML here. We need to make some changes. So what are they here? I'm gonna say on a school categories equals two crew. And here, along with message, we're gonna get the categories but degree, common message. And inside this were only used class equals two alert alert, dash category, Sir. This team. Okay, now let's go back to our server now, fuse, perform something like fish. And before you see the messages much market. Really? If I said something like this, okay, did not do anything. Care didn't do anything wrong on danger. I need to explain. What's the problem with that? Mac here, It's Dean. You? Yeah. Okay, let's stop. This would run quiet again. Yeah, It looks all right. In this way, we can actually show the messages to the user based on the actions that they perform, and they born any confirmation of any operation that silver has done. All right, let's get to the next lecture.
21. Problem Statement: Hey, guys, in this lecture, we're going to discuss the problem statement off her final project, which is we're going to build a blogging application that can perform the falling application operations right so a user should be able to register and log in, which means he must be able to create and then just that users should be able to create, edit and delete the block post right? The block post can be anything that the user want to write or share with. It is any investor should be able to view the blockbuster and by all uses, which means a user might not have an account in the in a Web site. But it must be still ableto do the poster. And but users will have accounts, all right, so these other operations that are upset must be able to provide for the users. So how do we actually approach it so you can stop this video, go ahead and cry your own approach. But if you are puzzled, so continue with this picture. So how to approach this problem? So first we need to design a database for the application, so we need to create people's that are gonna hold the data that are consistent with the website and then design endpoints for application, like just a log in view the block posts, edit them, delete them any kind of thing. So we need to create endpoints for the application. And then we need to start building the politician friend and like, rooting routes. You don't have to handle the request right now. I just need to create their endpoints and then great the application front end. So that whatever request that there has been from the client, which can be which in gold a particular end. All right, so we're just quitting routes are handling the request. And then after creating other routes, now you can develop the back and for the application, which is gonna handle all the rest from the user and also rest want to those request by two inserting operations. All right, so this we're better. We're going to approach the problem. So let's get ahead and start one by one.
22. Create Database: Hey, guys. So now what we're going to do in this literally is actually created database tables so that a blogger application can store data that requires it needs. All right, So I'm coming here, and I'm going to degrade the open the est. Really? Wait, my still commanding. And here I'm going to give my pasta. Yeah, and know what I'm going to raise? I'm going to create the database, Dad. Abyss. Okay, so now we need to use this. Use. Scored. Be? Yeah. And now let's go ahead and create the table. Create Jember on my table for stable. We're gonna have to have two tables. The 1st 1 will be user because we need to let the user square that counts for themselves. And then the 1st 1 will be the user on this Gariety. We're going to give a use ready for him, and it will be off better dessert. And one of the future that we're going to introduce here is auto increments. All right, score increments. Why is this necessary? Because we are going to create users and giving you ideas for them. So this is not gonna be the hands of uses where we get our in our in our hands, But we're gonna make it automatic because the database will populate a sum in digital value for this in an increment basis so that every user will be uniquely identified. So the first reserve will have one. The next will be to actually between We don't have to be bothered by that direct. So by doing this, we can actually let the database create the i d as well as we can identify the user. But you needing all right after this, give him of you to actually get the first name, and it will be back are the size will be 20 and then we're gonna actually take the last name and then that I will be back a 20 or size and then we're gonna ask for using this is different from first and last. This is will be unique as well. If you have already used some sites upset, you can actually understand why this needs to be unique to identify the user. Although we have also given use variety and use the name as well these both us this book will stand uni use around described it will be handled for more like general purposes. For out, Just use a name will be able to handle on the user side, all right. And not recognized for the me. And this will be unique to right, uh 30. Unique. Okay, now we're gonna ask for password on this will be off back 100. And now let's face for the Primerica. Although all of them are unique, we need to do only one primary key. The primary key will be user in the score. Hiding young. Yeah, the table has been created. So after these worlds were gone, we need to actually create another table for the block posts. So let's go out and do that yet. No. Jeb dog. And the 1st 1 would be blogging to score i e d. And it will be in D. J. And we're also live with the order on the scoring agreement. Um, then diary Idol of the block by, uh oh 100. And then the other. Or there 40 and then the body off the, uh, work off bloodlust. Back 1000. Because what? It will be much younger. And then there is a primary t trying Lee key. And this would be are going to sobriety now, Gordon C. Yeah. Now they're completely created. The boat tables that we need for a hair, a mess. And with this, we can actually head to the next step.
23. Design Endpoints: Hey, guys, in this lecture, we're gonna learn how to create and what? Ah, and points we're gonna create. All right, so let's go ahead. So these are the basic and points that we're gonna create. So the 1st 1 is the basic root. This is a get request, and it's gonna load the home page off her website. All right, The next is about page. It's gonna let load the about page. And there is also the get request, and the Tories also get request, which is gonna load the registration page. All right, this is where the ah form will be given to the user of a canal. Submit his details. The fourth is a poster question, but this is from the same website, the Register. But instead of get this is gonna post the details off user and if where if the farm is validated to be true, it's gonna create the user and the next He's the 1st 5th twenties. Get request. The end point is logging. This is gonna lured a form for user logging. The next is post from the same endpoint. But here it will validate the user credentials and make sure that users will be logged in if they submitted the right ones. And the next one is a get request. It is off endpoint right desk block here are formed, will be loaded for users so that he can write a block pores and next is opposed to Chris from the same in point here. Whatever the data that he's written into the block coolest form, it is gonna be created as a new block. And the next is a get request on this. One point is from Blood Slash and in T J Key. Here we have spacefaring it as an I d. The moment we have created the database, we have actually used Blogger the score i d. This is similar to that. So when we actually used his i d, we're gonna bring out the block port that matches with this given i d. The next is a get request, which is my blog's. This will list all links off blocks run by the logged in user. So whatever he has written during the time until then, all of them will be low loader. All right, on their on an extra little bit. Get request. This is off the desk block slash the idea of the blow. This will order form where we can actually ended the block post off this particular block. And the next one will actually, uh, poster Abd Asians that we have performed in the previous request. Alright, What else is left on the last war? A get request both off them. One is delayed, death blogged and blogged. I d. This will delete the block post with the given i d. The last one is a get request off Lago. This will lager the current user. So these are the endpoints that we're actually gonna use to create our website problems application projects. So these are some basic design and points, so we can use them as a basic framework and we can go ahead and develop the project. So let's go ahead and develop our project so that we can actually see the result off. All the skills that we have learned throughout the course will be collaborated in this single final project. Let's get ahead
24. Setting Routes: Hey, guys. So after designed the endpoints. Now we need to actually build the application, friend. So let's go ahead and do that part. All right? So the first thing is, we need to create the folder that we want to have. Ah, very full. No. So what I'm gonna do is I'm going to the new and creating. You called her which thing as, uh look, yeah, and I'm gonna set this holder. So inside it what I'm gonna do is I'm gonna create in your file as Abdullah by Yeah, but before that wanted to. What we need to do here is we need to actually, uh, installed all of them. Okay, What we're going to do is I'm gonna open make terminal. So first thing first, I'm going to create a new between environment. Autumn virtual end. Wait. We need to go inside a lot. Yeah. Now our virtual end, I'm going to give the same really, really creates the virtual environment part for us. Oh, but by the time it creates, let's go ahead and create. Let's come here and create Fuller completes. Yeah, you have it. Andi, What happened? So So you don't have anything like that. Okay? We need to actually created So I'm gay. Virtual love. This must created Yeah, this one queen A little error, but it's OK. You might not see all those things. So what happened? So let's just read And in this create so that we don't have a problem with it. It has finished creating all of them. So I'm inside my virtual environment. So now what? I'm gonna reason. Installed blast. Uh, yeah. And now Bibi install flask does boot strap. Yeah, I think you're good to go. So come down here and create from flask in port And I ask And then from a mask on the score Bootstrap, bootstrap And now have equal still flask all underscoring school named of London score and then bootstrap. I think it's good. Just said this thing. If underscoring the name brand, the score equals two double on the school named the learner school. And there's a Abdullah front. See the stair. So what else we've got left here? Here. So now we need to create a Basij team that so come down here these dot html inside. This extends bootstrap slash beers, voltage demand And now what? We're going to do is we need toe set some blocks here, so I just want to be block try to and here on block. And here, we're going to see a block. And now what? We're going to lose with that? Create another block. Um, content. Okay, you can just copy this. And now inside it. Subcontinent. Yeah, I think now be able to go from here. We can actually divide everything that you need. So let's go ahead and create some endpoints that we actually, uh, have created in the previous lecture. So first thing for us, we degrade the root and point at door throughout. And this one will be index redeye, the detective. Get the render underscore template in the score. Template. Yeah, transport. Downplay it. Well, say index dotage T matter now. Come down here. We need to create the index dot html and questions for us. We need to extend the bear storage family, block, subcontinent and lock. And here we're gonna say index. Yeah, let's go ahead and test it for a while. So I'm coming here. Fight on on drug by. That is running. Come back here. Let's go to local course. 5000 poor. Yeah, it's working. So what we need to do? Rest, eyes. You need to create rest of the importance that we have Ah, set for ourselves in the previous lecture. So the next thing is round about smash involved. And, uh, this will be about and returned running around the score template aboard or html abode origin. Well, just copy whatever is here. Come down here basted instead of next to say about yeah, and then what else we have got? You have to create the blog's one. So Abdareh week I've got route now slash block slash i really and then do logs off. I d. Okay, now we need to return. Randall on the score. Complaint Lock started. Html comma block in a score. I d equals toe. I'd say this thing Come back here. Let's create a new find box shortage team. And inside this what? Going to copy? Days Come back here pasted, but here, log love on the score. I d Yeah. And next thing iss at ap dot route. Uh, just er and then do you just, uh, wait. One thing we need to make sure is distant will accept all the matters that we want my mean get in post. So here it will be get and the next one will be caused. And that's it. Now we're gonna return, rendering the score template, and this will be registered dot html So you can come back here to read in your file. Just the not html juster. Say this back abduct by I'll come back here. So what else we've got? We'll keep you need toe. Just copy this thing now base it here in Schlafly. Just say it will belong in and the methods would get a post the same as well. And we need to change this to log in dotage email and this one will be logging as well. All right, now come back here every five. All right. Now, after seeing logging road HTM let's come down here with a new file with logging dotage D In there after this, copy everything from here. Go to log in dot html and just say more this lug it. All right, so now we would have got by now. What else? We've got left. Instead of flogging for Kevin, if you will given out to have brought route Nash right dash blawg slash. That's it. And then we need to actually make sure the reactive methods methods equals toe. Um, get coma balls, and then we need to do this one. All right, Now, let's write the function, and it will be right on the score Blow on this floor. And it really did nothing in it does. Now we need to return. Religion is called template. And inside it, we're going to see right. That's no office by dash blogged about extreme Let's. And with that, go ahead and create a new template. Right desk Love. Garbage demand. Gosh there. Right post. See this thing? Go back, Grab struck by And now come down here and again at door route. And now what else we have left? Okay, We need to give my dash bloods, and then the methods can be Get off post. Get my Oh, this can be my desk gloves. Right. Okay. My name is good. Logs on read Brenda and underscored template My dash blocks. Not HD and man Abdullah Crowd smash. You did Dash Law. Now you need to specify what block. So I d. Right now. Now we need to make sure that relaxes would get then horse as well get and then the unit underscore blub. And now get a handle on the scope template. You did a gash law daughter back here. Where did you find you? Need dash law? Dotage. Demon. I know. Paste this. I don't say a law love pitch. See if this thing goes back to abstract by anything else we have left down, okay? We need to make sure that we can be able to delete a post slash. Do you need God's law? Get, uh, closed. And now the doing? No. And then to regard just a success, because being in Syria and then the last one, we need to make sure that we can log up. So it's national goed. Then you log out form also not form function for it and said played Go dotage. God, including you. Find Mr Saved this thing now. Where? Chip disclosed Distance? Yes, over the game. Yeah, Okay. Like 15. Yeah. Come back here. Okay, Now this is his run, you know, go back here. Appreciate knicks about kid percent dash logs, great prizes. Okay, because we have returned. My text books are create my dash walks knowledge. So head off. News back here. Basted servicing. Come back here, Trish. It are. You continue. Okay. Let's go ahead and change. Wash here. My loads. I see you. Yeah. Okay. So in this way, you can actually make sure that we can see blog's blog's. Yeah. So these other endpoints that were created for ourselves. So these are very crucial, as we have listed all of possible routes that we are going to use in our application to finish it. So this let's go ahead and create somebody's to handle. Actually, all of these requests
25. Register and Login: Hey, guys. So now we're going to work on user registration and logging. So I have already developed the court for this part of the project, so I'm gonna go through how to develop. So if you come down here, here is the extreme apart for a registration. So what? And it is The first stage is, uh, after extending the based on HTML inside the subcontinent block, I'm going toe. I'm going toe open this form where the matter is posed. So here each item is inside the form group. If you see every dictator element isn't is belong to the class form group, right form group formed group from work form with all of them because these all make a single form objects already inside it. I created labels and also input types for each of them. And the 1st 1 is first name and last name. Use the name he made password and also confirm password Well registration and the final is the submit button. So this will help us to create a farm that is going to accept details or interest entered. It is for the user registration. So if you start running your application so I know my application is running. I come back here and from index page, I goto register. Let's see, what happens here is the user registration page. You can actually enter details regarding ah, what you want toe. Give the details for the user and you can test this out. But this doesn't work unless you actually handled the request. All right, so this is the part where we actually go to the application dot pie. And here, after going down, you can see I have always started the renovation everything before eso You just need to fall a long discourse because we have already learned how to set up the database. How tactic that the bootstrap, Everything. All right, So here's are just a part of her application. If you see, the first thing is I'm taking with questions, post or not. If it's not posed, it's just going to return this template. If it is posed, the first thing it does is it's goingto take all the details from the phone, and the first thing it does it will check whether the password and the confirm password are equal or not. So if this doesn't match, it's gonna show a flash message saying passwords do not match. You need to try again and then retaining the template. All right, so if the passwords do match now, it's going to squeeze all the details out off the user. Details by first name, last name, user name, email, password. And what it's going to do is it's going toe, create a cursor and execute this command. What it will do. It's going to insert all the details into this. Use a table in the in, according to this attributes. But while actually saved the password, it's going toe. Use the hash, generate password hash, all right. And then it is going to commit the ah, whatever it's executed. And then close the cursor and everything goes according to what we have done is going to show a flash message saying registration is successful and then reality to log in. Why? Because a user has created his account. Now he has to log in. All right, let's go ahead and test the registration part on I'm here. What I'm going to do is I'm going to come down here on I'm going to give some data like the first thing I'm going to do here is ah ritually does Shall we give the 1st 1 will be, um, Frank. And then the last one will be frank. Um, Hofstadter. The new user name will be Frank Underscore 123 And the email will be frank ed rid of gmail dot com. The password will be, um that's just give it as 123 ABC, and then come from prices 123 ABC. Now, let's just sit submit, you see registration successful, please. Logging. So if you do have any doubts, come back here. Now, if you run into select style command, you're gonna show Frank here, right, although showing John because I have tested this application after believing it. So you don't have to do that. So Frank is a user that we have created right now. All right, so now the logging part. So let's go ahead and see what's the logging. You see, there are two items inside this form using him and passport. So let's see how we have did that. So go to the logging dot html. You can actually see um, extending based orange, Tamil and inside the content, just as we have done for registered averaged email. We have used the diff tag and also the form and the class on the deformed groups. And instead of first name, last name and every other detail, all were needed. Here is user name password and the button sub me. All right. After you write the score, this page will appear for you. All right, So what should we do after entering the details? So come back to the abducted by now. It's time to actually handle the lugging request. So come down here. So if you actually see what we have done a bunch of stuff here. So first we need to check whether it is a request post or not. If it's not Post, we're just going to return the template on a previous post request. We're gonna squeeze the details from the request using the repressed art form, and we're gonna grab the user name and password. The first thing we're gonna do is create a cursor and execute this command. What will do It will first check whether there is a user existing with the user name or not . So select star from user to user name is equal to this year's the name the use of what we what he has submitted was and then the result. If there is any result, we're gonna fits the 1st 1 And now we're going to check whether the passwords match or not . And after matching the passwords, we're gonna say, session logging equal to true here, using the session variables because we need to know whether the user is logged in or not after starting the session variable logging and then saving the first name in the last name . Where are we going to use this? Inside the flash message, we're going to use the session first name you have successfully logging. And then if the passwords do not match but the user exists with the user name, then we're gonna say close the Casa pass, which does not match and written the logging html temple. And if user doesn't exist, we're gonna say, Use that. Does user not found and written this template? All right, this is a long process, but still it is quite easy. All right, so let's go ahead and run our replication and come down here, Frank. 123 And the password is one toe three, ABC Great! 123 ABC now hit Submit button. Now, this much Londoners. No, the user is not fun. Why? Because the user name is Frank on the school Wanted. Three. That's where we have got it wrong, Frank. Under school 123 And now the password is 123 ABC hit the submit button. It says passwords does not match because they have given a wrong password. Now, Frank, all I'm doing this is to make sure that our application books well, 123 ABC now hit Submit now you can see. Welcome, Frank. It says the name you have been successfully logged in. So this is how you can actually go ahead and develop registration and logging for our red side. So I hope you do very vell in this part because this is a vacation implicated part. All the before. Lectures are just learning park. So all the best. Let's get to the next lecture
26. Create and view Blog Posts: guys. We have computer, the registration and logging part of her project. So now it's time to focus on the blogged a block party. So in this lecture, we're gonna learn how to create a blawg, save it, view it, and also show the list off blocks that have been created by any specific user. All right, so that his own main goal in this lecture. So I have read in court that's gonna make us do it. So if you first focus on right hyphen, blogged cordage, seven page. This is the entire block application, for it is entered block part that is gonna help us toe below form for entering blawg information. So if you see like we have done for the registration, Rajan, there is a form and inside it there is a from group elements off the class and sorry developments are formed group class, and then we have here is the title part. And this is the body part. If you see that that this is the type of element in port, but this is off text area, and now we have the button which is going to submit all of the information that has been entered in here using a method post. If you're up to here, here is the class CK video. All right, this is a very, very important thing, right, Because we're gonna use the secret if we have to install in to it, which we're going to do in a little time. Ah, but you're going to do shortly. So and the next thing is, after we have written it and saved saved, which means submitted the blogged that everything here, we're gonna save it insider database on after saving it. So let's go to the application part. All right, let's go to the right. Typhon. Blawg store function here is the right underscore blawg function. So given and I access toe this method, the very first thing is we're gonna take whether its poster Not if not, this is a get request. We're gonna return this html page. If it is a post request, uh, we're gonna access the form data, and we're gonna squeeze the air out off a title body and the order who is actually logged in. So here is where the session comes to use, and we're gonna create the cursor and execute the statement what it will do. It will save the dead up there. What? It brought the barrister title, the body and the other who is who has written this application title body another. All right. And after this, we're gonna come in the command changes and then close the cause. We're gonna flash. We're gonna show the flash message and then really liked him to the index. So what happens at the index? If you come up here, you can actually see the court here. They're gonna list all the blocks that has been written by the logged in user. So here, we're gonna accept the closer, and we're gonna select star from Blogger. So then if result is greater greater than zero, Which means if there are any record since either at our best, we're gonna fit all of them and then we're gonna close the closer. But then we're gonna actually written it by actually passing the bloods data that we have got from the database. All right, if we haven't fallen in results, we're gonna close the curse 100 it just empty index original. So we have brought some change. The story index dot html page. Let's go and view them. So here is the index dot html. So, apart from the extended based original in the block subcontinent, we're actually going to do some python stuff here using genes, Etro tempered engine Syntex We're gonna take whether there is a blog's is filled or not. If there is anything, we're gonna loop it because this blog's variable is kind off list because it contains multiple items and inside. So we're gonna loop it, and we actually view every one off it. So what are we going to do here is we're actually going toe through it a link here if you see a tag. This is a link which will be viewed as the tighty. But the link is located to blog's slash sorry, blog's slash and the idea off the block. All right, we're gonna refer this to, and we're gonna see Show him or her who had running the blawg, and that's it. If there is no blog's variable or the blocks wearable is empty, we're gonna say no blocks have been written yet. All right, so what happens when we actually click on it? Which means when we access this part, So let's go there. Blog's slash Here. This is the part where you can actually access it. So whatever, Going two days, we're gonna create a cosa access the broad application. Sorry. The block post, which is which matches this I d. And this part will be replaced by the idea because we have used the part on for mating. So if there is any result, we're gonna fetch that thing the 1st 1 which means the one that matches the I d and we're gonna show it. All right, But here the html is blog's right. HTML. So let's go ahead and viewed block storage Tamil, here. We're gonna actually see you're gonna have the title being viewed and then the body and then also who has written the blogged. This is a very, very important because we're actually viewing an entire block post in a single page here. All right, so now what we're going to do, let's go ahead and run it. But there is one single thing that we have to. Still what I have mentioned that we have used the ck editor here, so we need to actually install it. So let's go into our command line terminal. Yeah, After coming here, what we need to do is we need to run a command install for flask Dash CK editor. Sorry, The command is wrong. I haven't got the sea. So flask dash ck did her. - So just breathe until this installation fillings finishes. Yeah, it is successful in start. So know what we need to do is go ahead into the abduct by Come up to here and we need to import it. All right. Well, how we have done for flask underscored Bootstrap. We're gonna so do the same thing. We'll ask on the score. CK editor Import. Seek it It did you All right, Come down here. CK editor off. Right after doing the same with this thing. And now what we're going to do is go to the base dotage. Tamil, come down here creating new block. Now. What is this going to say? Look, wait here. Block heard, and we also need to end this block and block and then inside this what we're going to say is CK editor Dark Lord, after this just says super. All right, this is gonna call the super functioning sight desiccated your dark Lord and that will give us the what data that we need after this. Inside the blocks. Blog's dark. Yeah, we have given it. Alright, I get it. That's fine for us. So I think we're good to go. So let's go ahead and run our application. So by tone, abduct by Okay, test wt forms import exterior field. Okay. It says there is a smaller being found. No model named WT form. So let's go ahead and install that thing for us. Installed the beauty phones. Now you can go out and run you up by don Implication. Yeah. Now it is running, so come back here. So if you can actually go to write desk blawg pitch Yeah, now you can see the editor actually being much more realistic. All right, So what I'm gonna do is I'm gonna create something like, ah, son Rice. And then I'm going to say, Ah, Sunrise is who for life. Yeah. Now just submit this thing, Okay? It's his care. First name. What? Why? What did you do? It is okay. Poses some in order for us. So why longing? We have settles session for his name. Yeah, Okay. What's the problem here? Okay. We need to log in before we do that. All right. So local host no blocks have been written yet. So go to log in, and I'm gonna say Frank, underscore 123 And the password is one degree a B c. I'm logged in. So no. What I'm gonna raise, I'm goingto right. Dash blocks. Great. Right dash Blawg. Yeah, I'm going to see a sunrise and then say to sunrise Is hope for life? Yeah. Now submit this. Okay, If you see this, the index based successful a poster. We actually have this thing here, so if you click on it, you can actually see block title the blood body and President Frank off sharp. He's a user. All right. In this way, we can actually create and view the blog's the list of blocks and indexed ravaged female. Right? So this is a very, very effective V. So go ahead and cry your approach and let's go to the next lecture
27. Edit & Delete Blog Posts: Hello, guys. This is the last lecture in our course. So this lecture, what we're performing is editing a block post and also being able to delete it. All right, so let's go into According that the what we have done. So if you come there little you did this blow storage temer have laid out the form. You just do what we have done for writing a block post except wanting. It's gonna give the values that are already being taken from our database, and it will try to edit it. All right, if you go to edit, underscore blawg function, you can see if it's imposed request. You gonna access the, uh, Garbis, bring out the title and body parts, and you're gonna update it and commit the changes to the database, and you're gonna show a flash message. If not, what are you going to do? Is you're going to bring the block post from the database out around it, and you're gonna fits the details, and you're gonna fill the back. Ah, blogged. The editor desk blogged Rx camel paid with the block underscore form details. Which means we're gonna bring this details from the red abyss populate this dictionary and we're gonna use this dictionary here. You actually feel the data inside the fields are right here with title here body. Right. So another thing is, we're gonna be able to delete it. If you see here, deal it down the school block. Whatever. Going to dissect access the course, we're gonna get the i d. From here and there. Idea we're gonna perform the deluded operation committed and that. So finally, we have also a lager operation. Nothing. Best clearing the session. That's well about the user from the website. So let's perform it. So I'm here. Officiate. Okay, so now we must be able to go entity. So view Blog's now you can see the adoption deduction performing, you see? No, I'm going to see it. It it. And now submitted. Okay. Chose an error. Let's resolve it. So the Aires from I had gone by noon in the school. Blawg, Lord and feel list. Okay, let's score there. Okay. This is not block. This is body. Now say of this thing, Check with us. Over is warning. Yeah, I'll come back here. Refresh it. Now you can see the blogger updated successfully sunrise, Please hope for life. And we have also the edited parts. All right, now go to view Blog's. It's this Okay, It's his decision. The session might be expired by now. So what? I log in, Frank, Underscore. 123 Wonder three. ABC submitted your lot then. Now go to the View blog's No. You have this sunrise took deal it? Yeah, I think. Now it's been the leader. Let's go and check it. No, the delete function is not going to the place where we want. All right? It's getting this 10 redact slash my dogs. Okay, so go to my rest blocks. OK? Here. We might be a little adjustment. Yeah, Here. We need to say delete bearish looks, but it's going to get a little desk block my rods. Now let's go. Your website, you logs. Deal it. She's got an expect Your argument. What is the problem? Okay, we need this argument giving it a specified here. I d now I think it's okay. Lets go and refresh it. Okay, lets go Norden again, Okay? No, The block has been deleted. You come here. You're saying no blocks have been written yet. So in this way, we can actually you did it and delete it. So if you have approached any new way, you can also post your court so that this we're ending our course. So I hope you have learned that knew something new in this course. And you're in a unique way, so you can actually go ahead and learn a lot of stuff by actually implementing these in the practical in this practical part, and you're gonna get a lot of experience also, you could clog up. It's gonna show this. This will remain the course. Thank you very much for staying with us. Thank you.