 So, I hope yesterday all of you have created the library manager app, okay, all of you are on this library management project and if I do list, I'll see library manager, I'll see manage.py. So, these are, sorry, already created by yesterday, yes, okay, yes, all right. So, now we'll be proceeding ahead in this. So, we'll go to library manager. In library manager, as we saw, we have all these files, separate files. So, the models which will, which will be, okay, your, you can say it's your database, okay, information will all be in this models.py, all right, and views will be your logic. Currently, we don't have any templates, HTML templates, we'll see that, okay, we'll make that also. So, yeah, so things are separate. Now, let's, let's see what is in the views. So, we'll do notepad.exe. This notepad.exe will work only for Windows user. If you are in Linux or Ubuntu, you can use Vim or you can use any, any text editor, okay, a spider will also do. I'm just using this notepad.exe, it is quite easy to manipulate over here, not to jump here and there. So, yeah, notepad.exe space views.py will open that file for you. Just to note, so anyone who doesn't want to use notepad, they can open spider like yesterday and you will see the file browser on the top right. So, you can use spider IDE as well and you can see all the files on the top right and you can navigate views.py and all those files on the top right also. So, this is just one way of doing it using notepad and all of us tend to use different text editor. Can you mention once again the process like we have to go to the, we have done that open the notepad? Just open spider IDE and go to the folder that we created yesterday and you'll find all the files inside. So, rathamai says open views.py. If you remember yesterday, we had opened views.py by double clicking on the file name on the top right in the spider IDE. Spider was the text editor that we had opened. So, for anyone who, for whom the commands are not working, please do not get confused. Rathamai is using notepad because he's most comfortable with just opening the notepad from the command line. You don't have to constantly emulate or create the same command and run it. You can use spider IDE. Rathamai says just opening the file using the notepad command. You can use spider editor and open the file directly using your mouse. So, you don't have to sort of be stressed out about why this command is not working, why notepad is not working, etc. Please just open spider IDE or the spider editor. On top right, you'll find the files tab. Click on the files tab. Go to desktop, go to Django project, go to library management, go inside and you'll find all the files in one place. Please open it from there. So, from here on, Rathamai may tell you to open some file and he will open it using notepad.exe. You can just open it by using double click on your spider editor interface. So, please do not get confused. This is just one way of opening the file. That's it. Thank you. Go ahead. Yeah, so this is just, we are just opening a file and we are going to edit it. So, it can be done in any text editor in any way, okay, which is comfortable as Ankit said. So, yeah, so once you have opened views.py, you should see something like this. Create your views here. They have already imported from Django.shortcuts import render, which helps you render your content and provide a response HTTP, basically your HTML web page. So, all of you are on the same page. They have opened their views because now we are going to type the code. We are going to create first view function. Okay, so we'll be creating a first view function that is everyone are aware about writing a function. So, we'll create a function and we'll obviously follow yesterday what Ankit mentioned is this library manager and we have views.py over here. So, I'll be creating with same name. So, to be in sync. So, we'll create a view books and yeah, request object basically contains all the detail about the request that comes to the server on the client, all the information. Sometimes we also have a post and get all the details. So, that is quite important for the views. And now we are going to return a response. We want to return a response HTTP response. So, for now, before using this shortcut, we'll do it in a quite a trivial way in Django, that is we'll import from Django.http import HTTP response. Okay, so this is another class provided by Django to give your response, return your response. And this is what we are going to use. And in return, we'll just return HTTP response. And this can be any, you can pass any HTML content. So, like I'll just say books. Okay, for now, book number one, math book number two. Okay, maybe something on Python. And yeah, anything, okay, you can simply write books. This is just a demonstration of how we handle the request in a quite trivial way. And we are just returning some response. All right. So, yeah, you all can write up to this point. Do import the HTTP response class, which you'll be using to your response. And yeah, inside response, you can type anything you want. This is my first view. This is something that is just a stream, which will be sent to the client. Yeah, once you have done, don't forget to save the file. Okay, control s will help and whatever save. Okay, so important thing is to save the file. Any specific name is required to save this file so that in, I mean, no, no, no, no, no, no, the views itself is the name of the file. Okay. Yeah. So we'll, we'll now next we'll see how we when whenever Django gets a request, how this particular function is called. So we're going to save in the Django project only. Yeah, all will be in your container that is your library manager. Okay. So it's already present over there. We are just modifying this file. The web framework has already given us the structure. So it has done half of maybe 40% of the work for us. We are just simply writing what is the most important thing for a website. So it does import for us. It tells us that we should create low views here. It has already created the file at the proper location and also all done by the framework. I hope most of you all have completed. Sir, in spider, I cannot open this file. Yeah, I have. Okay. So, so this is your spider editor. Just give me a minute. It takes it's a little slow. Sometimes takes time. But this is your spider editor. There is a files tab on the top right. If you can see where I'm pointing. If you click on that, you should find a file sort of a file browser kind of a place. I'm just closing this. Your editor will look like this. It'll be an empty temp file. You'll then have maybe something like this on the top right. And if you click on files tab, then it'll open the files like explorer. I've clicked on the file tab now and I can see that the it shows me a list of files. Your file should be located in desktop Django project library management. If you go inside, you probably have to double click on every option to open them. And once you open them, you should be able to see all the files in one place. So, for example, library manager contains the views.py file which we just edited right now. So, open library manager. Just click on the arrow on the left near library manager and it'll show a drop down. It'll give you view views.py and it should open up on the left. It could take some time. Fyder is not known for its speed, but it will open up. So, if I double click on view.py, it'll open up on the left with a new tab. Here, you can basically just edit and say control S or you can click on the floppy icon here and save the height. So, given this information, are you still facing any issue? It is simply showing the text. So, not the few are considering as an active different colors. Or is it different for different editors? So, what sort of? So, let's have Python 3.9. It should look something like this. Is it looking something like this? No, content is same, but it is not looking like this. I don't get you. Did the file open on the left? Yeah, it's open. Yeah. Right, that's it. So, the colors may differ from version to version or something like that. It's a plain white. Yeah. Yeah. So, I may have a dark theme or something or the version may be different or whatever, but the color doesn't matter. What matters is the file open. Can you save it? Can you edit it? That is more important here, I guess. So, Jayanth, can you please confirm if you are able to do this? If not, we can still wait. Yes, sir. Thank you. Thank you. Abhisheer has asked, can you show how it is done in Notepad? In Notepad, you type what you want to type and then you click save. Prasamesh already did it. I don't know why you would want to use Notepad if you already have Spider. Like I showed you, you already have all the files on your left and you have the editor on your right. Please use Spider if you have it available. It is easier to move between different files. People who are not comfortable with the command line will find it difficult to constantly move to the command line, open a new file, then again go to Notepad, etc. And it becomes also confusing because Prasamesh or for example, some other person who is more friendlier with the command line can move from one folder to another very easily. For newbies or people who are new to the command line, it is difficult to change folders, open the correct file, etc. This will cause a lot more confusion later on. Please use the easy way out. There is nothing wrong in using the easy way of moving between files like the Spider editor gives you an easy way to do it. Nothing wrong in doing that. Prasamesh just prefers the Notepad so he is using that because he is already familiar with the command line. In case you are not or in case the command line is something that is new to you, I would recommend that you stick with the Spider editor and do not try for any new adventure. As long as you can edit the file and as long as you can save it properly, that is what is important. So we want you to save, edit the correct file here because then your application will work correctly. Thank you. All right. So I think everyone, like I have done with this part of the code. So fine. Yeah, once we are done with this file, we have saved this file. We will be moving back. Now the thing is, we have made a view but now we can create multiple views. We can right now add books. Later we may have add book, some other operations that we want to do. So it will be a separate view. So whenever request comes from client side, how does Django know that I have to use this view? I have to call this particular business logic. So that is what is done in our URLs file in which that is the place where we tie up the request with the view. So we will be moving now to the library management that is your project library management. Inside library management, you have another folder, the container library management which contains all your project settings file. So we will be moving there and you should see this file. I think CURLs, Vizgi, all these files, this file is mainly up here if you are deploying something. So we will not be touching it at all now. So I hope all of you can see URLs.py file already present in your library management container which lies within library management. There is one more folder library management in that you have URLs.py. So everyone can see URLs.py. We will be opening this URLs.py file that is our next file that we need to edit. So as Ankit mentioned, the spider editor will be easy for all to just move around the folder and edit the file. I will still be continuing with notepad.exe URLs.py. If you open this file, you should see a lot of information already present in it. So it already has one URL that is admin, which is obviously for admin user. We will test, we will check this URL as well, but after we write our own URL. So now we will just, you see it is, they have already mentioned so much information, function, views, okay, how will you write, okay, they have already given us, okay, how to connect it. So we have created function. There are also class based views, which are also quite, it depends, okay, both are equally strong, nothing like, okay, one is better, another is better than one. It is just as per your requirement, you create your views. So function is quite simpler, easier and also strong. So, yeah, how to now connect your view to the URL that will, the client will hit that URL. So, we have this already, we will see already present URL pattern. In this URL patterns, we already have a path admin, okay, and it will be calling some views, which has been imported okay, from the admin app. So we are similarly going to create one. So in this we will create our own path, that is URL pattern, yeah, we'll call it books slash, okay, trailing slash is a good practice, because then every time when you create a new URL, you don't have to start with a leading slash, that is the only thing, that is why we have this trailing slash written. Then this is your URL pattern. And over here, we can see we need to connect which view we want, okay, to be called for when the client hits this URL. So we have created a view called books, which is in a views file, views dot books, this is what we have created. We can give it a name, this is optional, but it is a good practice to give a name, because sometimes we can call this URL using this name. Later purpose, okay, this will be used in a slightly later part of the code. But for now, our main focus is tying up the URL with the view that you have created. So we are saying the URL pattern should look like books, and it should call the view that we have written views dot. That is a book. So this is a books, which is present in views file, so views dot books, okay. Now, one more important thing, this file will not know what is this views, from where is this, this view from where it has come. So we need to import it. So from a app, app is library manager, correct. We need to import the views, okay. This line is important, okay. So from our app, that is library manager, we are importing the views and this views, but books will now call your view, all right. So this is how we, okay, tie up the URL with the views. And similarly, you can create as many you want and good practice to give a comma after you complete, because next time you may have more URL patterns, okay. This line, you need to import the views. This line, you will be tying up your URL pattern, okay, with the required views. So kindly type this. Sir. Yes, yes. I am not understanding why we are doing in this URL dot view. The thing is, you will have request, once again, see you will have requests coming from the client side, correct, yeah, correct. So suppose there is a website like Facebook, okay. So you will have something like Facebook slash login, correct, yeah. Yes, sir. Yeah, where you will see login page, you will see Facebook slash register, where you will have sign up page registration, okay. Then you may have, after you log in, you may have Facebook slash friends will give list of all the friends, all right. So these are all URL patterns that, okay, a website will have, a website will have multiple URL patterns, right. Yes, sir. Yeah, so for, okay, particular request, what business logic should be executed? For login, I need the login logic, where I'll check whether the user is authenticated. For registration, I'll create a user. For friends, I'll, I know already who is the friend and they look up in database or the friend. So three, all these three things have a different business logic, right. Yes, sir. Yeah, so now I should tell, okay, my dango that for login, okay, call, okay, the logic which is present in views, I may have written login, login user, whatever name, name is just, okay, for, okay, our understanding that this is the login user. Then, so it can be anything. Then for register, okay, call this view, views dot, okay, you can say registration form or, okay, so and so, all right. And for friends, you can say, I should, your URL should call views dot, you can say all friends you may have written something like that, okay. I'm not typing, okay. So the Django should understand or any application for that matter, any web framework you are using, not necessary Django, but it should have some connectivity between the request and, okay, the logic that will be executed for that request, right. Yeah. Yes, sir. Yeah, yeah. So someone will hit Facebook login, should go to login, should not go to some other thing and should not wait, where should I go? It should be readily there. So we can create multiples. If we have login page, we'll have another path, login slash, which we'll call views dot login, okay, and there it will have its own logic. Yeah. Yes, I understood, sir. Thank you. Yeah. So this is the place where you will be wiring up your views with the URL pattern. And once you're done with this, kindly save the file. Okay. I hope all are done typing the code. Okay, fine. We'll be moving ahead. We have saved this file. Now the time to run a server. But before we run our server yesterday, we have added our app in the settings dot file, let us check that once. Yeah. So I think we've not added that part. We're not done. Add and wait. Okay, okay. So fine. So guys, now we'll be, again, we are in the same, what do you say, folder that is library management. This is where we have URLs. We also have settings dot py settings dot py holds all the information about your website, everything. Okay. So let us, let us open that. And if you open it, again, you can open it and any spider will be good. Yeah. So if you see it is, okay, settings for your project, everything is a lot of information is there. I would suggest, okay, it will take time for, okay, to understand this properly. So as you develop something, it is you'll slowly, slowly understand many more things related to this. So because if you look at the file, it's quite huge. Then two will try to, okay, see some important basic things that we need. For example, right now, okay, these are the installed apps in your project. So they are admin content type sessions and all those things. Okay. So basically, as I told you, web framework handles the sessions and this part is written already in Django, okay, in this, okay, package sessions admin will be seeing admin how well Django provides us with the admin interface. Authentication is basically log in, log out, okay, to authenticate user. So these are already present in your project. Okay. So Django provides already with all these things that are also middle whereas, okay, for security purpose also, okay, we have various middle whereas, okay, so quite, quite, okay, useful things already, okay, done for us. And we don't have to worry about it. We just need to focus on our app. So we'll be adding our app over here, that is, sorry, library manager, because a project should know means the settings file should know that, okay, library manager is the app which belongs to this project. So all the wiring up needs to be done quite important. So nothing magical happening, everything you tell, okay, to the Django and accordingly it will behave. So you need to mention that, okay, there is one more app now that is library manager. You can create multiple apps in a single project and you can start, okay, adding it over here. So library manager is the app that you created yesterday, kindly add this over here. Otherwise, when you run your server, it won't recognize library manager. Once you're done, save this, all right, yeah. So once you save this, let us move back to the terminal, okay, so right now, where am I? I am in, okay, the settings.py, okay, and I'll move one directory back outside my project container. So right now I'm in library management folder, okay, and if I see what is the content, it is, okay, I have library management, library manager, which is my app. Now, I will have manage.py file, okay, which will help me execute a lot of Django admin commands. So python.manage.py, I'll run server. So I am sure yesterday, you all did this, you ran the server. So this is the, so obviously, test server that will have to test our application. So yeah, we'll run this, python.manage.py, run server. And it will say that, okay, using settings, which is present in library management for this development server, okay, which will be at a localhost colon 8000. So all, okay, I've started your server. Okay, so see, what we did right now is we had a view, which is actually, will do all the processing, the logical work, and it will, okay, call the necessary HTML. The HTML also we have created, okay, it's over here. So, which will be rendered as per the context passed, and the response, okay, will just return the response to the client who is requesting for the, so in like whatever necessary resources. So this is how the flow is, okay. Now few things before I hand over to Ankit for further things like creating database, okay, all those things. We'll come to a file that is settings.py. This is one of the most, most, obviously, it is the important, the most important, I would say, because it contains all the things. So whatever magic that we see automatically, oh, you write in URLs, it automatically takes the URL, then you create templates, it automatically takes the template, it comes to know, because everything is specified here. Okay, there is no magic as such, it is clearly mentioned. So to understand settings itself, you need a lot of time, okay, you need to invest a lot of time in development and understanding the settings. But I'll give you a short quick overview of what is related to us, what we have done right now. If we see, yeah, we understood, install that, and all those things. You can see there is one more thing, group URL conflict. So here we have mentioned that kindly use library management.urls. So everyone has URLs.py file, correct, India library management. Yes, I'm right. Everyone has this file. So we are telling settings, we are in the sense by default, this is there, okay, we can give any other path also, and it will work fine. So we are the one who control will be controlling this, okay, where my URLs will lie. So over here, it's, that is why we simply wrote URLs in library management, it is working fine. We don't have to do anything else, because it's already there in settings. And templates also, okay, slightly, okay, many attributes are there, but okay, abdir, true, means this means that it will check in your directory that whether there is a template folder, and it will automatically, okay, find the fetch your HTML, you can make this false, and you can, okay, pass your directory over here, some means you have created your HTML somewhere else, okay, maybe on your desktop, not here. So you can pass that path as well, means or some inside your maybe inside your app, you don't want templates and all you want something else, you can do that, it is not like, okay, you can't, but then you have to, okay, tweak slightly with this HTML, I mean to say sorry, the settings.py file, okay, so it's all there, all right, so many settings are there, quite, okay, a lot of things to understand in this as well. So only to make clear that there is nothing magical, it's everything properly connected, mentioned and in control, all right. Now with this information, one more thing that we'll be looking at is, okay, now we'll be creating a user now, okay, basically admin user, super user. So right now I am in which directory, I am in the project library management, okay, directory. So here I have manage.py file, so manage.py file, okay, we can use it to run server to do many more things, we can also use it to create, there is a command create super user, okay, so we can use it to, basically create a super user. Before you guys do it, you all do it, I'll just first do it, it should give me an error, y'all can also try, it will show an error, okay, so I just pressed enter and it is giving me an error, okay, y'all can also try, should give almost the same error, if no errors then it is good, wait for me to correct my error, so python manage.py space create super user, okay, is the command, there is no space or anything, so I'll again write it over here, python manage.py create super user, this is the command, okay, that you will give now, so I hope most have this error, no table such as auth user, auth underscore user, there is no table. I am getting, you mean migrate question mark, okay, okay, all right, so migration, your spelling is incorrect, please check your migrate spelling, it is suggesting a better spelling, no it is giving the spelling, system is giving, what was your command, micromand is python manage.py create super user, okay, yeah, we'll see that one second, before that anyone who got the error, no error, got error, no error is fine, it says user name, the blank to use, yes then please wait, she's execute a command, if there is no error then wait, if there is an error then let us know, if there is no error then please wait for the next instruction. Yeah, can you give an example by writing a directory, as Smith is asking, but it will consume time for now because there are a few more things, later this can be tried, that's quite trivial, simple thing, so yeah, thanks, yeah, but no error, no error find, okay, so means no error is good, means you guys have already created the table, so fine, so in my case it is throwing me an error because okay, when I run python manage.py run server, if I do this, it's starting, okay, it shows me a message over here, you have 18 unapplied migration, your project may not work properly until you migrate, you do the migration, the apps are admin, auth, sessions, content types, these are all installed app that you had seen in settings.py, in settings.py you have already seen this, and okay, what does this mean is, migration is, in Django, you will be having this file called models.py, which is your next session about creating tables, so in Django, we write, okay, the database that we want to create, we write it in a pythonic way, we create a class like book, and it will automatically, once I do migration, I migrate it, it will automatically create a table in the DB, okay, so that is how it works, so right now, this is provided admin, auth, user, user, these are provided by our framework, Django framework, which is already present, so what we are going to do is, we are going to do python manage.py migrate, so we are going to create a table, okay, so this only, those who have error will do that, okay, because those who do not have any error will definitely do not have to do, because they have already created it, and so if I do this, python, and s.py migrate, okay, and I am pressing enter, and it will give me information, applying, applying, yeah, okay, these are all table information that is created in my database, okay, so anyone who got error, kindly run this common, python, space, manage.py, space, migrate, and I think Anand sir had some error, may go because if, after doing the migration, migration sir, gone, right, yeah, it has gone, okay, I am getting all okays. Yeah, okay, the list is not as long as you, it's short. Okay, fine, fine, that is maybe version, site version. Yeah, yeah, yeah, yeah, that is fine, okay, so everyone done with migrate, correct, let us see what is the status in chat. Yeah, great username, I will talk about it, please wait, Avinash, okay, what we did for not getting an error, so we got an error was that the table auth user is not found, if you see the error that we got, okay, it was, okay, no such table, auth user, so auth user is a table in the auth app provided by Django itself, the Django web framework, so it has, it is already there for us, we don't have to create user table, okay, that is quite helpful, right, and now this table, we just need to create a database, once we have a database and all, things will work properly, now this was missing, what migrate does is, what we ran over here command, that is pythonmanage.py migrate, it will create the table in your database, okay, and all this information is stored in the folder called migrations, okay, it is a folder which will be present in each migration, the time when we create a model, okay, that is what is about the next session is about, once you create a model, your library manager, you will get a folder called migration, which will contain all the information that, okay, it will instruct, okay, to the database to create the tables, to add columns, to alter the field and all those things, okay, which will be there, so migrate will simply apply those migration, those information, and it will make your database ready with the required tables and, okay, fields, all right, I hope that answered that made the things clear, okay, fine, now, if you have ran yesterday, you do not need to run it again, it is, it will show you have already applied, no migrations to apply, so not to worry at all, yeah, so if I do migrate again, I think it should give me, okay, no migration to apply, so you will get this message, if you have already ran the migration.