写个验证用户登录的装饰器:在调用函数前,先检查session里有没有用户 from functools import wraps from flask import session, abort def login_required(func): @wraps(func) def decorated_function(*args, **kwargs): if not 'user' in session: abort(401) return func(*args, **kwargs) return…