from application import app from flask import request,redirect from common.models.User import User from common.libs.user.UserService import UserService from common.libs.UrlManager import UrlManager import re
pattern = re.compile('%s' % "|".join(ignore_urls)) if pattern.match(path): return
if not user_info: return redirect( UrlManager.buildUrl("/user/login")) return
''' 判断用户是否登录 ''' def check_login(): cookies = request.cookies auth_cookie = cookies[app.config['AUTH_COOKIE_NAME']] if app.config['AUTH_COOKIE_NAME'] in cookies else None
已经找到问题了
if not user_info:
return redirect( UrlManager.buildUrl("/user/login"))
return
改成
if not user_info:
return redirect( UrlManager.buildUrl('/user/login'))
return