Flask installation and setup in Visual Studio Code | Flask in VS Code Tutorial Part #1

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
Hello friends welcome to cool it help this is flask in Visual Studio code tutorial part so let me tell you what exactly we are doing so I have created this complete session but the session was lengthy so I have divided this session into two parts in the first part we are going to set up the project environment for the flask inside the visual studio code before starting let's discuss few things about the flask flask is a lightweight python framework for web application with basic supports like URL routing and Page rendering also known as micro framework because it does not directly provide you the following features like validation database abstraction authentication and so on but we can use these features with the help of spatial python package which is called flask extension and flask does not provide you template engine but installing the flask which includes Ginger templating engine by default I will show you this thing at the time of installing the flask in vs code let's move towards the prerequisites here we have these three important prerequisites first one you must have the python extension installed in Visual Studio code the second one you must have python version 3. the third one is make sure at the time of installation of python you have checked the box and the python interpreter location is set in your path environment variable okay let's begin with this first prerequisite so I'm in the visual studio code just click here on this extension icon in the search just type Python and you will see the very first extension which is provided by the Microsoft when you click on it you will get the install button click on that install button and soon this will be installed on your system and once the installation is done you will see this kind of message this extension is globally activated now we will verify our system has Python 3 or not so simply we will open the command prompt and here we will type python space hyphen hyphen version press enter and here we will see the python version that means python is installed and we are ready to move okay going to the next thing because I have installed the python with the option that I have checked and the python interpreter path is included to the path environment variable so before starting you can verify this thing so you have to go to the path environment variable on your system let's do it this PC go to the properties on the right hand side Advanced system settings and you will see this small window here click on this environment variables and you will see the path inside the user variable not here in the system variable because at the time of installation I have selected the option that installed for single user only that means installation is done only for the current user so we can get the path here in this user environment variable now you can see the python 310 the required path added here by the setup okay now we are sure that path is present in the path environment variable so far so good now I'm going to close this environment variable window and we will move to Next Step come back here in the notepad so we have a successfully checked all the prerequisites so we are fulfilling all the prerequisites now this is the time to create the project environment for the flask okay before starting again we have one important note we need to create the virtual environment in which we will install the flask using a virtual environment avoids installing flask into the global python environment that gives you the exact control over the libraries used in an application so this is recommended so we will do this thing in the following steps let's do it together so here we have the step one in the step one we simply create a folder on the desktop or anywhere on your system wherever you want and just open that folder in Visual Studio code so now I'm here so I have just created one folder now I'm going to open just click here on this file explorer and click on this button to open that folder so my folder is on the desktops I have just selected and this folder is opened here on the left hand side in the Explorer you can see the folder is open this was a simple step one now we are at the step two in the step two we need to open the new terminal in the vs code and then we need to run a following command to create virtual environment this is the very simple command and we will run this you guys can see the description for this command you will get all details there so this way open the terminal also you can notice here right now you are inside your project folder okay so your command prompt is open here in the terminal and you are inside the flask and the command is here press enter once you press enter this will take few seconds not take much time and this will not show you any message like success or failure whatever but if you see nothing that means this is created now we are at this step three in the step three we need to activate the virtual environment again we have a simple command go with here press enter once you press the enter you will see one thing The Prompt is started with the dot venv which is in green color that means your virtual environment is activated and you are working inside it now the step four in the step 4 we have to go to the command palette then we have to select the python interpreter okay go on the top menu view command palette and you can type here if you are not able to see this first option python colon select interpreter click and soon you will see the list of the installed python intercritters so uh in the list you can see one entry which is starting with this star icon and this is the right one and in the bracket we have dot v e n v colon V and with that means we need to select this python this is the dedicated and which we need for our virtual environment see this I have selected this one which is recommended great so far so good now we have completed the step 4 successfully now going for the step 5. again we need to open a terminal and then we need to activate the virtual environment if you have not closed the third terminal so you can do it through the command but in our case this is already open so we don't need for the step 5 we are going to step six now in the step 6 we need to run a command a basic command go to the terminal but make sure you are inside the your virtual environment then execute the command so we got the message requirement already satisfied because no need for update we have everything up to date if something would missing that will be installed now we are at the step 7. now in the step 7 we need to install the flask in the virtual environment for this we are going to run this command again I'm back here in the terminal now I have pasted the command pressed enter soon you will see downloading of the flask packages which are required and soon you will see the message successfully installed and you can see here Jinja that is templating engine the first one you can notice here that is installed with the installation of flask now guys we have a self-contained environment ready for writing the flask code okay and one important thing I want to tell you again to avoid your confusion to remove your confusion that how do you know that you are ins you are working inside your virtual environment so it's very simple when you open the terminal and if you are inside your virtual environment so you can see your prompt will start with this Dot venv so you will see that is the indicator that your virtual environment is activated and you are at the right place okay so guys this is the first part of the tutorial flask environment setup in the visual studio code and I would recommend you to watch the flask tutorial part 2 which we will create and run a sample app in Visual Studio code if you guys found this tutorial relevant and useful please hit the like button also you can subscribe to learn more and guys I hope to see you there in this second part of this tutorial and for now thanks for watching cool it help
Info
Channel: Cool IT Help
Views: 19,637
Rating: undefined out of 5
Keywords: Python and Flask Tutorial in Visual Studio Code, flask setup in vs code, how to install flask in python, flask tutorial, pip install flask, how to run flask app in terminal, how to import flask in python, flask documentation, no module named flask vscode, how to run flask app in windows, Setting Up a Flask Application in Visual Studio Code, run flask server in vs code, flask tutorial in vs code, Flask installation and setup in Visual Studio Code
Id: rI98HBgTiDM
Channel Id: undefined
Length: 11min 23sec (683 seconds)
Published: Thu Oct 06 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.