WEBVTT

00:00.890 --> 00:01.460
Okay.

00:02.630 --> 00:06.950
Now we know how to build a Django and how to use that framework.

00:06.950 --> 00:09.260
We can start our project.

00:09.410 --> 00:17.450
As we know, based on the requirements, we need to build a backend API for our application, which

00:17.450 --> 00:18.920
is movie rater.

00:18.920 --> 00:21.650
So we will need to create a Django.

00:21.690 --> 00:29.120
We'll need to also connect a Django rest framework to it and we need to build a few model serializers

00:29.120 --> 00:31.820
URLs and views and that will be it.

00:31.820 --> 00:35.120
And in the next few videos we'll do that together.

00:35.120 --> 00:37.220
So first thing first what we need to do.

00:37.220 --> 00:38.870
I have terminal open here.

00:38.870 --> 00:40.790
I'm inside the desktop here.

00:40.790 --> 00:42.860
I will create a new folder.

00:42.860 --> 00:43.790
So CD.

00:45.630 --> 00:49.450
Movie rater API.

00:50.040 --> 00:53.340
At the moment I'm creating just a folder is sorry.

00:53.340 --> 01:01.050
So what I need to do is mkdir and then movie rater API.

01:01.830 --> 01:03.300
So that's being created.

01:03.300 --> 01:10.530
I need to move to movie rater API now and inside that folder I can create a virtual environment.

01:10.560 --> 01:12.390
We know how to do it already.

01:12.390 --> 01:17.340
So python three m vnf.

01:17.490 --> 01:18.420
Vnf.

01:23.230 --> 01:24.580
We need to activate it.

01:30.050 --> 01:31.550
And this is activated now.

01:31.550 --> 01:35.150
So what we need to do is we need to install our requirements.

01:35.150 --> 01:38.960
So we need to install Django.

01:42.030 --> 01:43.860
We need to pip install Django.

01:53.160 --> 01:57.870
Also, we need to do Django Rest framework.

02:00.530 --> 02:02.570
And that's been installed.

02:03.260 --> 02:06.500
We can also run this command Pip install, upgrade pip.

02:09.740 --> 02:10.730
I suggested.

02:13.910 --> 02:18.200
And we have everything set up for us now.

02:18.200 --> 02:24.620
So let's open this, a new folder, this new application inside our PyCharm.

02:26.330 --> 02:27.410
I will go open.

02:29.490 --> 02:30.660
That's our new folder.

02:35.540 --> 02:38.270
And here we have our application.

02:38.270 --> 02:40.460
So virtual environment is here.

02:42.340 --> 02:43.410
We can do terminal.

02:43.420 --> 02:46.390
You can see it's automatically activated.

02:46.390 --> 02:48.880
So that means it's all working fine.

02:48.880 --> 03:00.460
So what do we need to do is now we need to create a project and an application Django admin start project

03:02.230 --> 03:06.820
and we call it movie creator and we would like to do it in the current folder.

03:09.680 --> 03:14.020
And you can see here movie writer has been created here.

03:14.030 --> 03:25.040
What we also need to do is we need to create an application so Django admin start up and then name of

03:25.040 --> 03:28.910
the application and we can call our application API.

03:32.090 --> 03:35.010
And you can see API is here.

03:35.030 --> 03:43.340
So the reason why I call it API is because we'll have just one kind of application that's very small

03:43.340 --> 03:49.050
application and this will be responsible for our API communication with our front end.

03:49.070 --> 03:56.960
So I call it API and inside here we'll put all our logic, all our models and everything that will be

03:56.960 --> 04:00.180
just exposed API to our front end.

04:00.200 --> 04:01.520
So this is how I call it.

04:01.550 --> 04:06.320
If you have something bigger, maybe it's not a good idea to call it API.

04:06.350 --> 04:12.110
I should split it into three smaller applications, but for our tutorial this is just fine.

04:12.560 --> 04:14.360
So we have that.

04:14.390 --> 04:23.210
Now we can make sure that everything is kind of working, so I will do Python3 Manage.py run server.

04:26.130 --> 04:29.430
And we can make sure it's working fine.

04:29.460 --> 04:30.930
Clicking on this link.

04:33.200 --> 04:36.170
And you can see Django is working.

04:36.650 --> 04:40.280
So all of that is fine.

04:40.310 --> 04:44.780
What we will need to do is what we can do is.

04:46.110 --> 04:48.540
We can try to run this.

04:48.750 --> 04:51.900
So right click, run, manage.

04:53.070 --> 04:59.940
It will fail because there is no configuration yet and we can do edit configuration here and then put

04:59.940 --> 05:01.560
run server.

05:02.800 --> 05:03.640
Here.

05:04.390 --> 05:08.590
And next time, wherever we would like to run the server, we can click it here.

05:09.980 --> 05:12.820
And it will spin up our server.

05:12.830 --> 05:15.020
So what else we need to do?

05:15.050 --> 05:18.110
As you can see here, we have 17 unapplied migrations.

05:18.110 --> 05:22.190
We haven't done any migrations yet and that's built in migration.

05:22.190 --> 05:28.370
As you remember from this settings, we already have some application in our settings.

05:28.370 --> 05:36.320
So all of this admin out and so on that has its own migrations and we need to run this command to apply

05:36.350 --> 05:37.730
them to our database.

05:37.730 --> 05:38.690
So now we'll.

05:40.270 --> 05:41.460
Killed that project.

05:41.470 --> 05:43.030
We can go to terminal.

05:43.030 --> 05:49.660
I can kill that control C and then we can paste python manage.py migrate.

05:51.430 --> 05:57.400
All of that have been added to our database and now we can use our application.

05:57.400 --> 06:00.010
So basically we prepare everything now.

06:00.010 --> 06:07.480
So we have our project, we have our application, we install Django and Django rest framework and it's

06:07.480 --> 06:13.330
ready to be started so we can start building our application from now.
