Hello, friends, in this video, we shall see how to set up the environment that is required for the
development of an application using the flight framework.
So setting the environment.
There are certain prerequisites for setting up the environment.
One is that you should have a Python version, two one six are, you know, even if the flask environment
or flask package as such works for Python three point three onwards, even if it doesn't work properly,
some of the extensions that you may want to use along with the flask, they are not properly ported
for the next or the later versions of Python.
So therefore it is always recommended that you should use or you should install the flat framework on
the top of Python two point seven.
So that is the recommended version of Python that you should use for.
Now, in order to, you know, develop flask application, again, another recommendation is that you
should install a virtual environment of Python.
So this is something which is very special to Python.
The use of virtual environment allows you to test your environment or your application in isolated environment
so that there might be a certain case where different libraries may be conflicting with each other.
So in order to remove the possibility of this conflict, it is always better to install a virtual environment.
So this virtual environment can allow you to compare and test the environment side by side.
Well, how to install that by using a utility called Pip?
Now, Pip is a python.
Package installer, Stolen Bank, which stands for Biton Package in stolen, not this paper utility
for the Python two point seven point nine onwards people utility is, you know, Shipherd along with
their standard Python distribution.
But if you are having two point seven point eight or less than that Biton version two one seven point
eight or less than that, then the utility is not present in the default installation of Python.
So naturally, what will I do?
You'll have to install the itself first.
How to install pipe, get hold of a file called as get
dogpile from the Python package index by B.I and then run this by saying Python get dorper.
So what will happen now?
The BP utility will be installed in the scripts directly off your Python Python folder wanted to install.
Then you can, you know, run this command from the command, from PIP, install virtual EMV.
So the virtual environment will be set up.
Of course, this come on, nurse, an administrator privilege, especially if you are trying to do this
under Linux or Mac OS, so if you are doing it on Linux or Mac OS, you will have to add Suto before
it sudo pip install virtual EMV.
That will be the command that you will use on certain.
If you are on windows, then you have to log in as an administrator to execute that certain standard
Linux package like you want to have their own package manager, like for example, app.
So if you are on Ubuntu Linux, you just issuing commands to do Atget install virtual EMV so the virtual
environment will be set up.
Now this virtual environment will will be used to install or create an environment for the developer,
for the installation of the flask.
So once the virtual environment is installed now inside that virtual environment, you will install.
So in order to install or create a new virtual environment, all you have to do is to create a new directly
or folder.
I'm calling it a new project.
New project good.
Or log in to that directive.
I think Cindy and this virtual EMV is not already installed.
So just the virtual EMV V and the V is the name of my virtual involvement.
So what will happen?
The inside of the DMV directly inside a new project, new project.
All the required utilities and modules for a independent Pythonic distribution by Clapperton installation
will be created inside this V v in V folder.
So now that it is that it is there, it is done.
The virtual environment and the utility is required for the execution of Python are installed.
Now you can activate that.
You will activate that environment by saying the NIBIN activate this command is especially relevant
to the Linux distribution.
So if you are on Linux, you said just that we and we will activate the
newly created virtual environment will be activated.
If you are on Windows.
And if you are creating a virtual environment in the direction of a new project this weekend, we do
the 3D created inside new project.
There is a script.
SolarReserve that and then there is an activity.
So this is a document.
Yankees, come on, it will be accurate.
You know you are.
You have installed a virtual environment, you have activated it now inside that virtual environment
just to install flasks so the flask will be installed in the our current version in order.
So this is all the activity that you need to do in order to set up the flask and warm it in your computer.
Now, all these activities I will actually demonstrate to you with the help of the activities that I
will do in front of you the recommended version of Python for installation of Lasky's Python two point
seven.
So in front of you, I have opened the idle shell of Python two point seven point one two.
And this is the.
Python thrown in front of me.
If I write any valeted.
Biton statement that will be.
Properly executed.
Which means that.
In this machine, batons two one zero point one two is available.
You can also verify this by executing the python interpreter from the command line.
So in this machine, the bottom 270 kolon slashed by Tonto's to seven is the installation, the reward,
one to seven.
So from this command prompt, I will start the Python interpreter just by issuing Python Command.
You see that the python prompt appears here.
Also, I can execute any.
In.
Wildhorn statement like this.
So which means that I don't have a label in this machine.
Next is for the installation of different packages.
Despite our distribution, must help keep utility available.
For the pattern distributions after Python two point seven point nine BP utilities already present in
the Python bundle, so just verify whether this is available or not.
Otherwise, you may have to install the capability by using the get Pip Courtney while.
How to find out whether it is present or not, just issue a simple task to search.
All the occurrences of.
By saying, yes, so if I see.
This Nordyke is available in the scripts subdirectory of Bitauto seven, so it is present.
Now that it is present.
I have to see whether the virtual environment is present or not, so.
If I try to.
Install it by using the pipe.
What happens, let us see.
If I say.
Scripts, because there is a folder in which the people, utilities present people.
Install.
Virtual envy.
What happens?
The requirements are already satisfied.
That means the virtual environment is already set up in this.
You can also verify the presence of virtual environment by running the same search command.
There is inside the scripts, the virtual envelope is already present, so that.
Prerequisite, prerequisite or requirement is already fulfilled.
Now we shall use this virtual inverarity to create a virtual environment for that.
Let me create a new folder.
I will call it as.
Flask envy.
Let us log into that directly.
And now uses virtual Ironweed or Yuxi to set up a virtual environment.
So where is that virtual environment?
Virtual N.V.?
It is inside.
This directly.
We are.
And then you the name of the virtual reality or virtual environment that you want to set up.
I use the same name.
So the virtual environment will now be set up.
It is collecting the requirements set up to speed, will, etc., and those will be set up inside the
flat invigilator inside the.
Flaws in that we already created, so a folder of this name will be created and inside which all the
quadroons will be.
You know, installed so this the installation is complete.
So now that the virtual environment named as class envy is set up, let us go into that directly and
see what all the resources have been installed inside that folder.
So this is the pattern for the way in which the virtual environment is set up by the same name Laskey,
and this is the virtual reality folder if you expand this.
You will find that this all include directly, live directly and scripts directly is these folders are
created to go inside the scripts.
This is the.
All utilities that are required are, you know, available in this is an activity in a batch file that
is a deactivated batch file and then there is also a local paper also is present if you want to install
some.
In packages inside this virtual environment, you can use these people, not you, you do not have to
use the global pipe that is available in Python to seven additional directly in order to install something
in this virtual environment to use these people.
And then there is also a python interpreter which is available for the local environment or virtual
environment.
So this is all about the installation of virtual environment, which is the first part of our installation
procedure in the next part.
We shall see how to activate this virtual environment and install the package inside that.
So this is the folder in which the.
Virtual environment has been set up.
This is the name of the virtual environment directly Flask N.V..
Inside, which there is a scripts folder and inside service that is in activate, not bad.
So if I say.
Go into this.
There is a script folder.
And there is a.
This activity not bad, so I have to invoke this to activate the.
This.
Virtual environment named as Laskey in Israel go back to the parent Folden.
And then say flask.
Lask N.V..
Scripts.
And then stick to it.
The.
Bagis.
So you can find that just before the command prompt, the name of the virtual environment is appearing
in the brackets.
So now we are in the virtual environment from which you can invoke the python interpreter.
Also, if you find that in the scripts folder, there is a python or the.
So if I start this python, python will start in the virtual environment.
Like this.
So this is Python interpreter is now working in the virtual environment called this flask EMV.
Come out of this.
And come out of the virtual environment by calling.
Deactivate.
So we'll come back to the problem.
So this is how.
The second part of the virtual environment installation, how to activate, how to start python interpreter
in the virtual environment and how to deactivate.
That is Alwiya C.
Then we come to the installation of Lask.
So first.
Activate the virtual environment.
By calling the to.
Batch file.
And then run the.
BP utility to install flask.
It is present in the scripts folder.
People install flask.
All the dependencies and the modules inside the flask package will now be installed.
Lastly, to sing successfully installed all the dependencies.
Ginge and Works, Zogu, etc., are all installed successfully inside the virtual environment, so the
installation is complete.
I will now invoke the python prompt.
And then I will say, sorry, import.
Import flask.
So now the flask is already present in our virtual environment, now that the flask is imported, we
can now go ahead and use the flask framework for other activities.