Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed A Social Network with Flask!
You have completed A Social Network with Flask!
Preview
Probably the simplest view we'll write for the entire app. We'll use a handy method from Flask-Login to log users out.
Use flask_login instead of flask.ext.login
New Terms
-
logout_user()- Method to remove a user's session and sign them out. -
@login_required- Decorator to mark a view as requiring a user to be logged in before they can access the view.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
Okay, so we want to be able to log users
out.
0:00
This is something we're gonna, we're not
gonna write the HTML for this just yet
0:02
because we're gonna do that when we build
our whole layout.
0:05
But we do wanna go ahead and make a view
for this.
0:10
So let's go back over here to app.py, and
0:12
we actually need to do a couple of
imports.
0:15
So if we come up here to our login line 3.
0:17
So we have a login_user.
0:22
We need to import logout_user as well.
0:24
And then, because we don't want, it
doesn't really matter, but
0:28
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up