Python Flask: AttributeError: 'NoneType' object has no attribute 'is_active' Python Flask: AttributeError: 'NoneType' object has no attribute 'is_active' flask flask

Python Flask: AttributeError: 'NoneType' object has no attribute 'is_active'


Nowhere in the block starting

if user is None:

do you actually assign anything to user, so it is still None and you get the error. Try changing to:

user = User(nickname = nickname, ...)

or call

user = User.select().where(User.email == resp.email).first()

again at the end of the if block