1.FBV方式:添加验证装饰器 def auth(func): def deco(request, *args, **kwargs): u = request.get_signed_cookie('username', salt='user', default=None) if not u: return render(request, 'login.html') return func(request, *args, **kwargs) return deco @authdef index(r…