WEBVTT

00:05.070 --> 00:06.660
Everyone welcome back.

00:06.660 --> 00:11.470
So in the last video we stopped by installing the virtual machine of a button.

00:11.820 --> 00:19.170
And in this video we're going to basically install flask which is the main web you know web application

00:20.340 --> 00:25.440
package that we're going to be using to make our web services and we're also going to be setting up

00:25.440 --> 00:26.840
the hello world.

00:27.120 --> 00:28.940
And we don't have to understand everything.

00:28.950 --> 00:34.930
Hello world just to make sure that flask is installed correctly make sure everything's working and then

00:34.930 --> 00:40.050
in later videos we're going to be dissecting the hello world example and understanding what's really

00:40.050 --> 00:43.300
happening behind the hood.

00:43.740 --> 00:44.070
OK.

00:44.070 --> 00:50.480
So the first thing is we have to install a flask and flask is a Python package so we can install it

00:50.480 --> 00:51.300
right there.

00:51.570 --> 01:00.390
So you can click control of TV which will basically open a new terminal or if you want to go to just

01:00.630 --> 01:05.830
here and type terminal then you could already see terminal here and click on it.

01:06.030 --> 01:06.420
OK.

01:06.420 --> 01:13.690
So once you have your terminal open go to your desktop and then you're going to write pseudo app install

01:14.830 --> 01:25.560
Python 3 so you want first to install Python 3 that that is going to ask for your password and make

01:25.560 --> 01:27.110
sure you let it continue.

01:27.360 --> 01:32.680
And it will basically install BIOS and 3 that.

01:32.810 --> 01:43.490
OK so once Python 3 has installed you can go and write the install flask and then let it download flask

01:44.390 --> 01:45.450
and install it.

01:47.020 --> 01:53.960
And then once we're done then we now officially have that sort of flask.

01:54.130 --> 01:55.680
So let's just make sure.

01:55.720 --> 01:57.850
So less right by three.

01:58.360 --> 02:07.750
And then you can rent important flask from flask in port flask and there should be no problem here.

02:07.750 --> 02:10.810
So with installed flask successfully.

02:10.810 --> 02:16.590
Now let's let's start and do a new project in the platinum flask and just one.

02:16.600 --> 02:17.310
Hello world.

02:17.310 --> 02:20.140
See what how this really works in flasks.

02:20.140 --> 02:30.760
So let's first exit from here and then you can install any ID in a virtual machine.

02:30.760 --> 02:38.920
For me I like to use ATOM which is a free ID but I know that everyone has their own preferred ID to

02:38.920 --> 02:40.300
work on in Python.

02:40.360 --> 02:49.090
So I have not that any I didn't do any videos to install any of the ideas but if you haven't installed

02:49.120 --> 02:53.600
any ideas yet on this machine pause the video and make sure you install.

02:53.620 --> 02:55.840
Any idea whether it's at home.

02:55.990 --> 03:02.170
For me I use ADOM which is what it's going to come here.

03:02.200 --> 03:09.730
I enjoy this idea a text editor basically But if you have any other things which you enjoy and you enjoy

03:09.730 --> 03:15.160
writing code on then make sure to install it before completing the video.

03:16.210 --> 03:24.130
OK so I'll assume now that you have opened up your text editor or your ID and then just create a new

03:24.130 --> 03:26.790
file and then we're going to save it.

03:26.890 --> 03:28.990
Save it on the desktop.

03:28.990 --> 03:38.020
Create a folder and say let's call it tutorial one and then this file We're going to call it amped up.

03:38.030 --> 03:38.600
Why.

03:38.780 --> 03:43.910
OK now he doesn't have to be cold at all.

03:43.920 --> 03:44.290
He y.

03:44.290 --> 03:48.590
But you know it's just a convention and flask call it at IPY.

03:48.760 --> 03:52.710
But it does have to have the Y extension of course.

03:53.050 --> 04:00.670
OK so we will save that and then now we're going to be writing a very very basic web service in flask.

04:00.670 --> 04:05.410
This is basically a very easy hello world and you don't have to understand everything about it.

04:05.410 --> 04:08.090
We're going to explain everything in the later videos.

04:08.170 --> 04:11.090
So this is just to make sure that everything is working.

04:11.260 --> 04:15.220
So we're going to write from flask in port flask.

04:15.220 --> 04:20.690
Make sure it's a capital F and then app is equal to a flask.

04:20.830 --> 04:25.460
So the constructor a flask and then we do.

04:25.510 --> 04:36.440
And after route and then define and then hello world.

04:36.700 --> 04:41.160
We're going to find a new function called the lower level and we're going to return.

04:41.800 --> 04:44.160
Hello world.

04:45.160 --> 04:45.690
OK.

04:45.760 --> 04:53.180
And then finally we're going to come here and say its name is equal to.

04:53.830 --> 05:01.830
Or if a name is equal to mean then what do we do after a run.

05:02.320 --> 05:09.790
And in these nine lines of very few lines of code we have essentially wrote web service that works in

05:09.790 --> 05:10.650
flask.

05:10.930 --> 05:13.210
OK so how do we run this Web service.

05:13.210 --> 05:15.150
Obviously that's what we want to do.

05:15.460 --> 05:23.910
So if you come here to and let's list the directories Let's go into a tutorial one.

05:23.990 --> 05:32.920
Now once we're here we can see that up why file in front of us now you want to write that at the why.

05:33.020 --> 05:37.490
So we're going to first derived export flask.

05:37.700 --> 05:42.360
App is equal to and then wrapped up you why.

05:42.440 --> 05:47.150
So we're telling Flast that the name of the application that we're running is called apt up.

05:47.150 --> 05:47.670
Why.

05:47.810 --> 05:50.810
Because our file is called at the Y.

05:51.290 --> 05:57.010
Now once we export that we simply write flask run and that's it.

05:57.020 --> 06:05.360
We have a fully working application that is running on be as and this address over here and it's listening

06:05.420 --> 06:07.250
on port 5000.

06:07.310 --> 06:13.180
So if we copy this you can copy using Control shift C and then you go to your browser.

06:16.110 --> 06:22.650
And then write to here and then you're going to see in front of you hello world.

06:22.860 --> 06:28.080
And if you notice year you might you'll get a message also that says get and we're going to talk about

06:28.320 --> 06:30.690
this a lot more in the coming videos.

06:30.840 --> 06:33.240
But yeah that's basically the Laurell program.

06:33.240 --> 06:38.610
It's OK if you don't understand most of the stuff you're going to go into too much details off of every

06:38.610 --> 06:45.430
single part of what we wrote and you should be fine even if you don't understand anything so far.

06:45.450 --> 06:51.760
So if you have this halo wrote in your flask is fully installed and I will see you in the next video.
