#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. We have created database and we've created the create user page. We've done all the routing in the background.
0:11 We've got the function in there to throw the data in. Everything's linked. Everything's done. Let's actually add some data. So let's run the Flask app.
0:21 Flask run. One set's running. Let's bring up the website. And we should see that this is the homepage.
0:30 You do not need to be logged in to access this page. And that's intentional. We'll get to that later. And let's go to create underscore user.
0:40 And on this page we have... This is a page where we can create a new user. So let's create that user. Let's call him Julian.
0:52 And let's make the password ABC123 because we're rebels. We hit submit and if you notice the page is actually going to reload
1:02 and we get that user created Flash message. This is the message that we obviously specified. We did the HTML and the template to get it to show up.
1:13 And that means the user was added to our database. So bring up your SQlite database if you have it. And open up our site users.db file.
1:26 And lets see what's in there. And looking at that database file we have our table, our user's table. And we browse data and there we go.
1:36 There's the user I just entered. Let's see if we can add some more. Now we can say, bob. We can say, not ABC123. Submit. We can throw in Mike
1:50 we can say what's wrong with you guys it's a great password. Then we can throw in some other random people. Let's bring the database back in
2:01 and when we refresh it we see all of the data in there. We have Julian, we have Bob, we've got Mike we've got Jason, and we've got Brian.
2:12 All of these people were added in by our web app. And that's really cool. So we've created a web app. It takes user data, it dumps it into an
2:22 SQlite database using SQLAlchemy and now with this data we can actually finally get to Flask log in and use these people to log into our website.
2:35 And you'll be able to see how the views change based on whether you're logged in or not.


Talk Python's Mastodon Michael Kennedy's Mastodon