#100DaysOfWeb in Python Transcripts
Chapter: Days 57-60: Flask Login
Lecture: Let's add some users!

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Okay we're finally there.
0:02 We have created database
0:04 and we've created
0:05 the create user page.
0:08 We've done all the routing in the background.
0:10 We've got the function in there to throw the data in.
0:14 Everything's linked.
0:15 Everything's done.
0:16 Let's actually add some data.
0:18 So let's run the Flask app.
0:20 Flask run.
0:23 One set's running.
0:24 Let's bring up the website.
0:27 And we should see that
0:28 this is the homepage.
0:29 You do not need to be logged in to access this page.
0:32 And that's intentional.
0:33 We'll get to that later.
0:35 And let's go to create
0:38 underscore user.
0:39 And on this page
0:41 we have...
0:42 This is a page where we can create a new user.
0:45 So let's create that user.
0:47 Let's call him
0:49 Julian.
0:51 And let's make the password
0:53 ABC123 because we're rebels.
0:56 We hit submit
0:58 and if you notice
0:59 the page is actually going to reload
1:01 and we get that user created Flash message.
1:05 This is the message that we obviously specified.
1:08 We did the HTML and the template
1:10 to get it to show up.
1:12 And that means the user was added to our database.
1:15 So bring up your SQlite database
1:18 if you have it.
1:19 And open up our site
1:22 users.db file.
1:25 And lets see what's in there.
1:27 And looking at that
1:28 database file
1:30 we have our table, our user's table.
1:33 And we browse data
1:34 and there we go.
1:35 There's the user I just entered.
1:37 Let's see if we can add some more.
1:40 Now we can say, bob.
1:42 We can say, not ABC123.
1:46 Submit.
1:48 We can throw in Mike
1:49 we can say what's wrong with you guys
1:53 it's a great password.
1:56 Then we can throw in some other random people.
1:58 Let's bring the database back in
2:00 and when we refresh it
2:04 we see all of the data in there.
2:06 We have Julian, we have Bob, we've got Mike
2:08 we've got Jason, and we've got Brian.
2:11 All of these people were added in by our web app.
2:15 And that's really cool.
2:17 So we've created a web app.
2:18 It takes user data, it dumps it into an
2:21 SQlite database using SQLAlchemy
2:26 and now with this data
2:28 we can actually finally get to Flask log in
2:31 and use these people to log into our website.
2:34 And you'll be able to see
2:35 how the views change based on
2:38 whether you're logged in or not.