1
00:00:00,153 --> 00:00:01,692
- [Narrator] Hi, and welcome back.

2
00:00:01,692 --> 00:00:02,987
In this video, we're going to be

3
00:00:02,987 --> 00:00:06,133
setting up with our SQL reading

4
00:00:06,133 --> 00:00:08,234
changes to our API.

5
00:00:08,234 --> 00:00:10,673
The first thing I've done is
I've copied all of the code

6
00:00:10,673 --> 00:00:13,690
from the last section, section four,

7
00:00:13,690 --> 00:00:15,601
and I've put it in a new folder,

8
00:00:15,601 --> 00:00:19,734
just because I don't want
to change the old project,

9
00:00:19,734 --> 00:00:21,487
I just want to create a new project

10
00:00:21,487 --> 00:00:24,285
that's going to start
from where we left off.

11
00:00:24,285 --> 00:00:26,025
So I've created a new folder

12
00:00:26,025 --> 00:00:27,489
and I've put the old code in it,

13
00:00:27,489 --> 00:00:29,713
made a copy of it, and now I'm going

14
00:00:29,713 --> 00:00:32,470
to create the virtual environment.

15
00:00:32,470 --> 00:00:35,743
What to do is inside the folder

16
00:00:35,743 --> 00:00:38,078
where you have your code folder,

17
00:00:38,078 --> 00:00:40,328
so, in there is my Python code.

18
00:00:40,328 --> 00:00:42,976
In the parent folder of that,

19
00:00:42,976 --> 00:00:45,849
I'm going to create a virtualenv.

20
00:00:45,849 --> 00:00:48,433
I'm gonna call it venv, or you can call it

21
00:00:48,433 --> 00:00:51,314
whatever you want, this
is just a name for it,

22
00:00:51,314 --> 00:00:53,099
and make sure that you're using

23
00:00:53,099 --> 00:00:55,682
Python 3.5 as a Python version.

24
00:00:59,114 --> 00:01:01,179
It'll then do it's thing and create

25
00:01:01,179 --> 00:01:03,846
the virtual environment for you.

26
00:01:05,406 --> 00:01:06,929
Now, because this is the same project

27
00:01:06,929 --> 00:01:08,680
as the last section's project,

28
00:01:08,680 --> 00:01:10,766
we're gonna need all of
the libraries installed

29
00:01:10,766 --> 00:01:12,525
that were used in the last section.

30
00:01:12,525 --> 00:01:16,024
So, source, venv, bin, activate.

31
00:01:16,024 --> 00:01:17,208
Remember, this is the command you wanna do

32
00:01:17,208 --> 00:01:19,369
if you are on Mac.

33
00:01:19,369 --> 00:01:20,687
If you're on Windows,

34
00:01:20,687 --> 00:01:24,687
you want to do ., venv,
scripts, activate, .bat.

35
00:01:31,562 --> 00:01:33,601
But, now that we've activated
the virtual environment,

36
00:01:33,601 --> 00:01:35,878
we can see the venv there at the front,

37
00:01:35,878 --> 00:01:40,400
and what we're gonna do is
instal the required libraries.

38
00:01:40,400 --> 00:01:44,067
So, what we're gonna
is pip, instal, Flask,

39
00:01:45,015 --> 00:01:48,265
and that'll instal Flask there.

40
00:01:48,265 --> 00:01:50,598
Pip, instal, Flask-RESTful,

41
00:01:52,811 --> 00:01:54,061
if I can spell,

42
00:01:58,959 --> 00:02:00,959
Pip, instal, flask-JWT.

43
00:02:05,750 --> 00:02:07,283
And, I think that's us.

44
00:02:07,283 --> 00:02:09,832
So, now that we've got our
three packages installed,

45
00:02:09,832 --> 00:02:13,888
we are able to run the
project from the last section,

46
00:02:13,888 --> 00:02:17,309
so you may wanna try that if you want,

47
00:02:17,309 --> 00:02:20,059
so python code/app.py.

48
00:02:21,024 --> 00:02:24,289
As you can see, that
starts without a problem.

49
00:02:24,289 --> 00:02:27,694
Now I'm gonna stop it, because
we're gonna be making some

50
00:02:27,694 --> 00:02:30,466
pretty interesting
changes in this section.

51
00:02:30,466 --> 00:02:32,441
What we're gonna be doing first is

52
00:02:32,441 --> 00:02:34,743
we're going to allow the users to sign up,

53
00:02:34,743 --> 00:02:35,988
so that's gonna be the first change.

54
00:02:35,988 --> 00:02:38,861
We're not gonna touch the
items, or the item list.

55
00:02:38,861 --> 00:02:40,618
The first thing we're gonna add

56
00:02:40,618 --> 00:02:44,024
is the ability to sign up users.

57
00:02:44,024 --> 00:02:48,338
Now, we could have added
the ability to sign up users

58
00:02:48,338 --> 00:02:52,082
in an in-memory database
just like we have our items,

59
00:02:52,082 --> 00:02:55,219
and then, as soon as we
exited the application,

60
00:02:55,219 --> 00:02:56,517
we would lose the users.

61
00:02:56,517 --> 00:02:58,752
So, we could have done that
and we know how to do that,

62
00:02:58,752 --> 00:03:02,148
we just create a list of users
and then append a user to it.

63
00:03:02,148 --> 00:03:04,250
However, what we're gonna be doing is

64
00:03:04,250 --> 00:03:07,817
we're going to be saving
them to a database.

65
00:03:07,817 --> 00:03:09,204
And in this section, we're going to look

66
00:03:09,204 --> 00:03:13,012
at a SQLite database, but Python comes in

67
00:03:13,012 --> 00:03:15,292
with built-in support for SQLite,

68
00:03:15,292 --> 00:03:19,013
so we don't have to instal
any libraries for that.

69
00:03:19,013 --> 00:03:21,525
Now, in the next video,
we're going to get started

70
00:03:21,525 --> 00:03:26,427
looking at how we can use
SQLite outside our API,

71
00:03:26,427 --> 00:03:30,594
and then after that we will
integrate SQLite with our API.

72
00:03:31,472 --> 00:03:34,055
So, first of all, let's
look at how SQLite works.

73
00:03:34,055 --> 00:03:35,990
I'll see you in the next video.

