WEBVTT

00:01.660 --> 00:07.030
Okay, we have our application running and we have our project.

00:07.030 --> 00:14.770
But project is like a container for our applications and we might have more than one application inside.

00:14.770 --> 00:16.990
So what is actually application?

00:17.020 --> 00:23.530
Application will be part of your code of your project that will do a certain thing.

00:23.530 --> 00:30.550
So for example, you might have a project that will contain our do a lot of things, but application

00:30.550 --> 00:34.210
will have the single responsibility.

00:34.210 --> 00:37.690
So you can have multiple applications, you might have one.

00:37.690 --> 00:41.020
All depends on your architecture and your design.

00:41.020 --> 00:47.110
In this tutorial, we'll focus on only one application because that will be easier to maintain, but

00:47.110 --> 00:48.760
you don't need to keep it as one.

00:48.760 --> 00:54.280
You might have more than one and then you can communicate in between the application as you wish.

00:54.430 --> 01:01.030
So at the moment we don't have any application, so our Django project is kind of not usable.

01:01.030 --> 01:02.510
So let's create one.

01:02.510 --> 01:08.570
So how we can actually create one, I will go to terminal and in the same way as use, I use terminal

01:08.570 --> 01:10.820
in my IDE on my system.

01:10.820 --> 01:12.200
I can use it here.

01:12.200 --> 01:15.710
So I'm inside the tutorial folder which is here.

01:15.710 --> 01:18.440
What I can do is I have two choices.

01:18.440 --> 01:27.110
I can use a python manage.py this file as we use before or I can do admin Django admin the same way

01:27.120 --> 01:29.510
I've I've created a Django project.

01:29.510 --> 01:31.220
So one way will be Django.

01:32.940 --> 01:39.480
Admin and then start up and then name of the app.

01:39.480 --> 01:46.140
And I will I can create an app called demo so I can do it like this.

01:46.140 --> 01:55.560
Or instead of Django admin I can do python manage.py start up demo the same way I will use this one

01:55.560 --> 02:02.010
and if we'll go here you can see demo has been created here and we have two folders.

02:02.010 --> 02:07.650
So we have one demo here which is our application and this is our project.

02:07.860 --> 02:15.090
So some people prefer to have this demo or this application inside our folder.

02:15.090 --> 02:16.530
It's really up to you.

02:16.560 --> 02:18.330
How would you like to have it?

02:18.330 --> 02:26.280
But if that's up our application, it might be better to put this inside it or outside it.

02:26.310 --> 02:34.020
I will keep it as as it is here because it doesn't really matter that much at And then the only thing

02:34.360 --> 02:40.090
what you will need to do is you will need to have a reference, but you need to remember this is project

02:40.090 --> 02:42.070
and this is our application.

02:42.070 --> 02:48.190
So actually let's close this for now and see what we have in our files.

02:48.700 --> 02:50.770
Let's start from the root directory.

02:50.770 --> 02:52.990
Here we have our manage.py.

02:53.020 --> 03:00.040
If we open this file, basically it's not something that we will be interested in, but this file is

03:00.040 --> 03:05.410
for us to run our commands for our Django so we can forget about the content of this.

03:05.410 --> 03:09.880
But it is very useful file to to manage our Django.

03:10.420 --> 03:17.950
Another file we have in the root folder is database Sqlite3 that has been created for us automatically

03:17.950 --> 03:18.760
by Django.

03:18.760 --> 03:20.740
And this is local database.

03:20.740 --> 03:25.570
So whatever we will store in our application, any data will go here.

03:25.570 --> 03:28.840
That's not a proper solution for production environment.

03:28.840 --> 03:35.740
So if you put your application on a server, you should not use SQLite because this is more like a testing

03:35.740 --> 03:37.540
environment database.

03:37.960 --> 03:40.090
So it's very easy to set up.

03:40.090 --> 03:46.930
This is a normal file and you can write things into the sqlite3, but if you would like to have something

03:46.930 --> 03:51.910
fast and reliable, the option will be MySQL or Postgres database.

03:51.910 --> 03:58.000
But for now we can use this one because we are not testing that application on server yet.

03:58.270 --> 04:01.090
So what else we have to implement?

04:01.120 --> 04:08.290
We already talked about this, so we have our project here and inside the project we have few files.

04:08.320 --> 04:12.340
First we have URLs and then we have settings.

04:12.340 --> 04:17.980
The rest of the files are not really something that we will ever change, so we have some in it.

04:18.010 --> 04:24.520
This is for initiate our project and then we have a wsgi which is more like a configuration for our

04:24.520 --> 04:25.150
server.

04:25.150 --> 04:29.710
So let's see what's inside the URLs, inside URLs.

04:29.740 --> 04:34.120
As you can see here, we don't have a support for for Django, but it doesn't really matter.

04:34.120 --> 04:35.410
We can close this.

04:35.410 --> 04:41.050
So in here you have in the comment section, you have some explanation how to use the URLs.

04:41.050 --> 04:47.500
But basically what this file is doing is it will give us some kind of paths.

04:47.500 --> 04:53.440
So if we go to our application here, that's a URL we are using.

04:53.440 --> 05:00.640
But if you take a look here, we have another patch that is available, which is admin.

05:00.640 --> 05:07.150
So basically if I will type admin at the very end admin, I have another page here.

05:07.150 --> 05:10.060
We'll talk about this later in the course.

05:10.060 --> 05:15.640
But this URLs basically kind of do mapping for our application.

05:15.640 --> 05:20.890
So whatever we will have here, it will be available as a URL in our application.

05:20.890 --> 05:27.430
So at the moment built in we have admin, but we will create more our own later in the tutorial.

05:27.430 --> 05:29.020
So this is URLs.

05:29.020 --> 05:31.570
I can open another file which is settings.

05:31.570 --> 05:35.650
This settings it's all settings for for our project.

05:35.650 --> 05:40.120
So we will be talking more about this and we will change a lot of things here.

05:40.120 --> 05:46.360
But basically if you would like to change something in your application, you will need to do it here

05:46.360 --> 05:48.430
inside the settings page.

05:48.430 --> 05:51.400
So we have a templates database.

05:51.400 --> 05:59.770
You can see here Django Database Sqlite3 is the one we use, and this name of the file is exactly this

05:59.770 --> 06:00.490
name here.

06:00.490 --> 06:06.040
So if you would like to switch to another database, you will need to go to the settings and change

06:06.040 --> 06:09.100
it here and you have other options here.

06:09.100 --> 06:15.970
But as I said, we'll come back to this many different times and we'll add and change things on the

06:15.970 --> 06:16.330
settings.

06:16.330 --> 06:19.330
So basically the settings control our project.

06:20.110 --> 06:22.900
So that's our project.

06:23.080 --> 06:26.560
I will close both of this and I will go to the demo.

06:27.070 --> 06:32.110
In demo we have a few things and we will be talking more about these files.

06:32.220 --> 06:39.930
Later in the tutorial, but important files for us will be the models which is empty at the moment will

06:39.930 --> 06:40.740
be views.

06:41.370 --> 06:43.590
It's also empty at the moment.

06:43.590 --> 06:48.990
And also we'll have some other files here that we will create.

06:48.990 --> 06:54.630
But the models basically represent our objects in database, whatever.

06:54.630 --> 07:01.170
We would like to store something in database, we'll need to create a model here and then we will apply

07:01.170 --> 07:06.000
it for our database using a migrations command.

07:06.000 --> 07:10.500
And then we have also views and views will be kind of our endpoint.

07:10.500 --> 07:16.410
So if we would like to access part of our application, we'll use views to do that, but we'll be doing

07:16.410 --> 07:18.990
a lot of different things in our views and models.

07:18.990 --> 07:25.830
And also I will show you how to create another view files and how we can structure our application.
