Introduction to the Flask Video Series
Hello all, my name is Krishnak and welcome to my YouTube channel. So guys, today in this particular video, we are going to see about Flask. Now, Flask is a very important web framework in Python. You can actually use it for developing web applications, you can also use it for creating web APIs, you can also use it for creating machine learning applications, you know, where you're developing a lot of end-to-end projects.
So today in this particular video, this will be again a series of videos in this playlist where I'll be discussing about Flask. Many people had actually requested this. Yes, Flask and Django, I will do it parallelly and try to upload as many as videos so that you will be able to start learning it.
Now coming to this particular Flask, guys, what we are going to learn over here is that, you know, we'll try to understand a lot of things, how you can actually write different different functionalities with respect to creating web frameworks, with respect to creating web APIs, and all the things. In this video, we'll just go through the introduction part and we'll try to understand what exactly Flask is and how this framework actually works. Okay, so what I'm going to do is that I'm just going to stop my video so that you'll be able to focus on this particular session.
Defining Flask: Origins and Core Components
So, let's proceed. Now over here, if I talk about Flask, this is a web framework. Okay? So I can also say this is a web application framework, okay, web application framework which is written in Python. So the people who are familiar with Python, you will love this particular web framework because you will be able to create a lot of end-to-end projects. So if anybody asks what is Flask, it can be an interview question and all, you should basically say it is a web application framework written in Python. Okay.
Now you also need to understand, because whenever you learn any kind of framework, you need to know who has actually developed it, right? So the person who has actually developed it, his name is Armin—I hope I'm pronouncing it right. I hope I'm pronouncing it right, guys. If I'm pronouncing it wrong, please excuse me for that, or please, you know, apologies for that. Okay, so the person who has developed is Armin, okay, and he leads an international group of Python enthusiasts named Pocoo. Okay? So there is a group of some Python developers, some type of international group, this particular name is Pocoo. Okay.
And if I talk about Flask framework, guys, this is based on WSGI concept, which we will discuss today in this particular video since this is just an introduction session. And it also is based on something called as Jinja2, Jinja2 template engine. Okay? So we'll understand what is this kind of, what is this WSGI and what is this Jinja2 template engine. Okay? So we will discuss it in short, like we'll try to discuss it in detail what exactly it is.
Understanding WSGI: The Web Server Gateway Interface
Now, first of all, let's understand what is this WSGI. Now if I really want to tell you the full form of WSGI, it is nothing but Web Server Gateway Interface. Okay, so this is basically Web Server Gateway Interface. I'll tell you why this is very, very much important. You know, it's an amazing protocol. You can also say this as a standard or protocol. Okay, I'll tell you why. So, protocol. Okay, so let's proceed.
Now, I hope whenever you host any kind of web application, where do you host it? In a kind of web server. Okay, suppose this is your web server. Now, web server can be anything. I hope you have heard of Apache web server, you have heard of IIS web server, you have heard of different different kinds of web server. Now in this particular web server, you host your web application. This is your web application. Okay, so this is your web application. Just imagine that you have hosted this particular web application, which is developed by using Flask framework, okay, Flask framework.
Now from here, many people will basically be requesting this particular web server in order to access this web application. Just imagine that this is amazon.in website. Okay, amazon.in website. So suppose this is your request 1, this is your request 2, this is your request 3. And this request are actually called as HTTP request, right? These are HTTP requests which usually happens in WWW, World Wide Web, which we basically use it from our system. So these are your clients from a specific terminal or a laptop or a desktop, they are basically requesting this particular web application. So the first request will actually go to the web server. Now from this particular web server, there will be requiring a standard or a protocol which will be able to communicate to this particular web application. And this communication, for this kind of communication, we use something called as WSGI, Web Server Gateway Interface, for this kind of communication. So over from here, you know, they'll use this particular standard and they will try to communicate to this particular web application. Here you may have any kind of callable functions, you may have any kind of APIs, you may be having any kind of functionalities, right? All those things will basically get called and here you'll be getting the response. Amazing. I guess this is what WSGI is basically used for. It is an amazing protocol or standard, I can say, which is basically used to communicate between a web server and the web application. And remember, this web application is hosted in this web server, but for this web server to interact with the web application, there is WSGI. Okay, this is the basic introduction about WSGI.
Exploring Jinja2: The Templating Engine
Now, the second thing that I really want to make you understand is something called as Jinja2. Okay. Now, this Jinja2, what it is? Okay, I have also spoken about this because I told you that the entire Flask is also based on this Jinja2 template engine. Now, Jinja2 template engine is a popular template engine for Python. Okay, and this templating, this web template system, I'll also call this as a web templating system. This actually works with, how it basically combines a web template along with a certain data source. Just see this, guys, along with a certain data source. And what this data source will actually do, this data source will actually dynamically put, you know, or you can also say it will dynamically, like it will try to integrate this web template with a data source. Okay.
And the final aim that we probably know will be to render dynamic pages. Render dynamic pages. What does this 'dynamic pages' mean? Suppose, okay, so over here, let's consider one example. I'm basically creating a machine learning application. So my machine learning application is to classify whether the image is a cat or a dog. Okay, and then as soon as the person actually uploads over here and submits it, what happens? This actually goes and interacts with the .pickle file or the .h5 file of the model, right? And then it gives us a response. It gives us a response. So this particular response is coming from a specific data source. In this particular case, the data source is your ML model, right?
Now, when it comes back, okay, here the information is getting displayed, right? Here the information is getting displayed. This is in turn rendering some dynamic pages. So this is actually a dynamic page which is basically having the output once you have submitted something. And this becomes a very, very amazing system because here you are trying to combine or integrate a web template along with some kind of data source, right? Now the data source over here is an ML model. Tomorrow, you may also have a SQL database, you may also have a MongoDB database, right? We will be discussing all these things as we go ahead. And remember guys, all this kind of practical will be covered in order to make you understand because this was a request of many people to complete Flask and Django as early as possible, so I will do that. So please make sure that you watch these videos. Every day, two to three videos will be coming on all these things because I really want to complete it, because I also have to do some end-to-end applications, and for that I'm also learning some kind of web development by using this.
Summary and What's Next
Okay, so this is just an introduction session, and over here we have actually learned about WSGI and Jinja2 templating techniques or template engine, I can say. Okay. And one funny thing is that since they're heading this particular group, right, Pocoo group, so this is, both the projects are called as Pocoo projects. This, both the projects are Pocoo projects. Okay.
So in this video what all things we discussed? We discussed about WSGI, we discussed about Jinja2 template engine. So we have discussed about this two. In the upcoming video, what we are going to do is that I'm going to take a VS Code and probably show you a basic template that how we can quickly create a Flask app, right? So I hope you like this particular video. please do make sure that you subscribe the channel because many videos are going to come up. And I'll see you all in the next video. Have a great day. Thank you and all. Bye.