Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialRobust Tran
2,802 PointsChallenge issue
Please help me out, the challenge just indicated that I was wrong but it only showed "Try again" which make me confusing. I don't know where is the bug. :((
from flask import Flask, g
from flask.ext.login import LoginManager
import models
app = Flask(__name__)
app.secret_key = 'dfhd7sa897d98743^%*&hfdsjhf(*dfd'
login_manager = LoginManager()
login_manager.init_app(app)
login_manager.login_view = 'login'
@login_manager.user_loader
def load_user(user_id):
try:
return models.User.get(models.User.id == user_id)
except models.User.DoseNotExist:
return None
1 Answer
Chris Freeman
Treehouse Moderator 68,454 PointsYou are so VERY close! The error class should be "models.DoesNotExist
" instead of "
except models.User.DoseNotExist
". That is, drop the "User." and change "Dose" to "Does".
Robust Tran
2,802 PointsRobust Tran
2,802 PointsOMG, something is serious wrong with my eyes. Thanks alot :)