1
00:00:00,510 --> 00:00:08,280
In our previous lesson we installed the main packages open the main P Y in this lesson we will be using

2
00:00:08,280 --> 00:00:15,840
the config settings to decide what data goes to which file for example where to create the log files.

3
00:00:15,840 --> 00:00:19,100
Let's start by creating a config P Y.

4
00:00:19,530 --> 00:00:23,160
Right click on P Y Tello and choose new.

5
00:00:23,400 --> 00:00:28,500
Then click on new python file and set the file name to config and hit.

6
00:00:28,530 --> 00:00:29,030
OK.

7
00:00:31,440 --> 00:00:33,560
Lets close the project tab.

8
00:00:33,990 --> 00:00:35,940
Set to import os.

9
00:00:36,180 --> 00:00:42,810
We will also be using flask so set from flask import flask.

10
00:00:42,840 --> 00:00:45,510
Now we set the web address to default.

11
00:00:45,510 --> 00:00:54,270
Zero point zero point zero point zero which is your own host No the web port will be set to 5000 which

12
00:00:54,270 --> 00:01:04,410
is the flask standard project route will be set to 0 as path D by our name in the parenthesis we set

13
00:01:04,500 --> 00:01:12,930
o as path a B as path with the double underscore file which is the name of this config file.

14
00:01:12,930 --> 00:01:16,730
With this we can check which directory we are at.

15
00:01:16,810 --> 00:01:23,450
Let's copy this code and go to terminal type Python so we can start the shell set.

16
00:01:23,520 --> 00:01:30,090
Import os now we paste the code we copied since we are using the shell.

17
00:01:30,090 --> 00:01:33,730
We cannot use double underscore file name.

18
00:01:34,050 --> 00:01:41,820
So let's say delete this file name and set the actual file name dot slash com fixed up p y as we run

19
00:01:41,820 --> 00:01:48,930
this code you will see the directory name P wide Tello which is the directory where the config P Y file

20
00:01:48,930 --> 00:01:50,260
is.

21
00:01:50,340 --> 00:01:54,490
This path is what is in the project route.

22
00:01:54,630 --> 00:01:57,420
Now let's go back to the script.

23
00:01:57,540 --> 00:02:02,890
We also want to set the template directory type o s path.

24
00:02:03,000 --> 00:02:09,370
Join project route drone app slash templates.

25
00:02:09,420 --> 00:02:13,120
Now is that the path to the static folder.

26
00:02:13,200 --> 00:02:15,750
We'll do the same as what we did before.

27
00:02:15,900 --> 00:02:16,980
Always path.

28
00:02:16,980 --> 00:02:20,550
Join project route drone app slash.

29
00:02:20,580 --> 00:02:28,670
Static let's go back to the project tab and check we can find templates under the drone app.

30
00:02:28,680 --> 00:02:35,920
Also we can find static under the drone app the debug mode can be also set here.

31
00:02:36,100 --> 00:02:38,470
I'll set it to false for the moment.

32
00:02:38,470 --> 00:02:44,420
If you want to receive more information while you develop the app you can set this to true.

33
00:02:45,280 --> 00:02:52,190
Let's set the log file to Pete tell dot log which will be set to the top of the project.

34
00:02:52,210 --> 00:02:55,010
Now I want to set the flask config.

35
00:02:55,030 --> 00:02:56,890
This is the flask Web site.

36
00:02:57,010 --> 00:03:01,840
Go to flask dot P O C O dot org.

37
00:03:01,840 --> 00:03:10,630
On this site you will find the flask code samples the code here says we import flask set flask double

38
00:03:10,630 --> 00:03:15,700
underscore name double underscore to create an app object.

39
00:03:15,910 --> 00:03:21,580
Then we use this app object to create decorator at AP dot root slash.

40
00:03:21,580 --> 00:03:26,680
This means that access will go to h TTP call on slash slash.

41
00:03:26,680 --> 00:03:31,280
Zero point zero point zero point Colin five thousand slash.

42
00:03:31,300 --> 00:03:34,820
You can imagine this as the top page of the site.

43
00:03:35,050 --> 00:03:40,480
Once we access the top page hello world will be returned by using flask.

44
00:03:40,480 --> 00:03:46,360
We are able to go to certain sites or also use apps to make all sorts of settings.

45
00:03:46,360 --> 00:03:50,640
Here's a very short program but we will get into more details on the way.

46
00:03:50,650 --> 00:03:52,960
Just wanted to introduce you the idea for now.

47
00:03:54,010 --> 00:03:59,290
Now let's go back to the config P Y to set the app object so we can access it anytime.

48
00:04:00,420 --> 00:04:07,660
As we just saw on the site we set the app object followed by flask double underscore name.

49
00:04:07,860 --> 00:04:14,090
There is an option called template folder where we can set the HDMI all template folder.

50
00:04:14,160 --> 00:04:16,460
Here we set it to templates.

51
00:04:16,530 --> 00:04:18,930
Also we can set the static folder as well.

52
00:04:20,020 --> 00:04:28,250
Here we completed setting the app object if you are planning on using the debug mode set.

53
00:04:28,250 --> 00:04:38,690
If debug app debug equals to debug as we set the debug to false this f statement will not run but if

54
00:04:38,690 --> 00:04:42,080
you change the debug to true the process will go through this.

55
00:04:42,080 --> 00:04:47,390
If statement here I set the log file to p tell.

56
00:04:47,500 --> 00:04:51,460
But you can also change the file name to p y Tello or P Y.

57
00:04:51,460 --> 00:04:54,100
Tell whatever name is fine.

58
00:04:54,100 --> 00:04:58,130
Finally we've finished setting the config file.

59
00:04:58,200 --> 00:05:05,250
Now we need to launch a server from the main P why the code to launch the server will be set in controllers

60
00:05:06,030 --> 00:05:12,550
right click on drone app and choose new choose python file and name the file.

61
00:05:12,570 --> 00:05:20,760
Double underscore in it and hate OK on the left here you'll see that in it file that we just created.

62
00:05:20,760 --> 00:05:24,900
Again right click on controllers and choose new.

63
00:05:25,080 --> 00:05:30,520
Now select python file and again name the file double underscored in it and hate.

64
00:05:30,520 --> 00:05:40,590
OK let's close all these tabs now right click on controllers and choose new choose python file and name

65
00:05:40,590 --> 00:05:45,850
the file server and hit OK here we've created the server.

66
00:05:45,860 --> 00:05:47,930
P Y.

67
00:05:47,930 --> 00:05:51,470
I'll see you in our next lesson where we start on the server side.
