Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

我仿写了一个基础的系统,但是在登陆的时候出现这样的异常 #3

Open
ghost opened this issue Mar 14, 2017 · 5 comments

Comments

@ghost
Copy link

ghost commented Mar 14, 2017

点击了登陆过后报
Exception
Exception: No user_loader has been installed for this LoginManager. Add one with the 'LoginManager.user_loader' decorator.

查阅了flask的文档关于user_loader的部分
if self.user_callback is None:
raise Exception(
"No user_loader has been installed for this "
"LoginManager. Add one with the "
"'LoginManager.user_loader' decorator.")
不知道为什么会是None,与数据库有关系吗。不知道为什么出现这样的情况。望赐教

@ghost
Copy link
Author

ghost commented Mar 14, 2017

在model.py里加了
@loginmanager.user_loader
def load_user(user_id):
return User.query.get(int(user_id))
之后可以了,不过为什么例子里面没有也可以呢?

@ghost
Copy link
Author

ghost commented Mar 15, 2017

你好,我也在学习这个小项目,可不可以一起交流一下 =。=

@lalor
Copy link
Owner

lalor commented Mar 15, 2017

二位好,我最近比较忙(是真忙),你们可以研究一下。我最晚会在4月底之前更新一下如何获取用户id这个问题。

@ghost
Copy link
Author

ghost commented Mar 15, 2017 via email

@ghost
Copy link
Author

ghost commented Mar 15, 2017

我也在写注册,不过我的数据库出了些问题。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant