1
00:00:01,000 --> 00:00:01,810
Hey, welcome back.

2
00:00:01,810 --> 00:00:04,420
In this video, we will set up our Django app.

3
00:00:04,420 --> 00:00:08,440
So we created a QR code previously.

4
00:00:08,440 --> 00:00:12,670
Let's close those files and go to the terminal.

5
00:00:14,180 --> 00:00:17,900
So just here, you want to install Django first.

6
00:00:17,930 --> 00:00:19,820
Pip install Django.

7
00:00:30,990 --> 00:00:32,390
So that's the first step.

8
00:00:32,400 --> 00:00:33,480
You install Django.

9
00:00:33,510 --> 00:00:35,320
Then you create a project.

10
00:00:35,340 --> 00:00:38,370
Then you create an app for that project.

11
00:00:38,400 --> 00:00:46,870
Then connect the app to the project and then run the app to see the results on the website on the browser.

12
00:00:46,890 --> 00:00:50,640
So the second step was to create a Django project.

13
00:00:50,670 --> 00:01:02,190
To do that you do Django admin start project my site space dot.

14
00:01:04,440 --> 00:01:13,170
I've explained this command previously, but again, what that will do is it will create a mysite directory

15
00:01:13,170 --> 00:01:15,830
in the current directory.

16
00:01:15,840 --> 00:01:19,840
The current directory is app 18 restaurant menu.

17
00:01:19,860 --> 00:01:26,700
So now here you'll see if you do a reload from disk, my site will show up.

18
00:01:26,700 --> 00:01:31,050
So that folder with all the Django files.

19
00:01:31,050 --> 00:01:34,980
So these are default project files.

20
00:01:35,010 --> 00:01:38,730
Now this project doesn't have any apps yet.

21
00:01:38,760 --> 00:01:46,980
We can add one or more apps to this Django project using Python manage.py.

22
00:01:47,250 --> 00:01:50,610
So Manage.py is one of the generated files.

23
00:01:50,610 --> 00:01:53,430
It's located in the root directory here.

24
00:01:53,460 --> 00:01:57,660
Manage.py Space start app.

25
00:01:57,660 --> 00:02:04,060
This is the command and then give a name to your app.

26
00:02:04,060 --> 00:02:07,180
Let's call it restaurant underscore menu.

27
00:02:07,210 --> 00:02:17,250
Don't have spaces in the app name press enter and that should create a new directory restaurant menu.

28
00:02:17,260 --> 00:02:23,920
So both my site and restaurant menu are two directories in the root directory.

29
00:02:24,040 --> 00:02:34,120
So we have an app, but we need to connect that app to the My site project by going to my site settings.py

30
00:02:34,420 --> 00:02:39,310
and then scroll down to find the installed apps.

31
00:02:39,340 --> 00:02:47,980
These here are some default apps and then after the last comma you want to press enter to create a new

32
00:02:47,980 --> 00:02:51,130
line and then create a new empty string.

33
00:02:51,130 --> 00:02:55,540
And inside the string you want to copy paste the name of your app.

34
00:02:55,540 --> 00:03:01,390
So restaurant menu copy it and paste it inside here.

35
00:03:01,390 --> 00:03:10,560
Make sure not to have spaces in the string inside the quotes, and then leave a comma here so that if

36
00:03:10,560 --> 00:03:15,600
we add more apps to our Django project, then we can do that in here, right?

37
00:03:15,600 --> 00:03:19,350
So that's a list of strings.

38
00:03:19,350 --> 00:03:27,720
Each strings points to the name of an app, save the file with Ctrl or Command S, and then let's run

39
00:03:28,500 --> 00:03:30,090
the project.

40
00:03:30,180 --> 00:03:38,400
So to do that, to run a project, you do Python Manage.py followed by the Run server command press

41
00:03:38,400 --> 00:03:39,000
Enter.

42
00:03:39,150 --> 00:03:43,170
And so that should display this URL.

43
00:03:43,200 --> 00:03:44,310
You can click that.

44
00:03:45,570 --> 00:03:49,470
And that should show you the default website.

45
00:03:50,100 --> 00:03:56,520
So we see this default website because we haven't mapped any URLs.

46
00:03:56,520 --> 00:04:02,040
So we have instructed Django yet what to do when the home page is visited.

47
00:04:02,680 --> 00:04:05,200
So that's something we'll do in the next videos.

48
00:04:05,200 --> 00:04:06,340
So let's keep going.

