问题相关代码
elif Password == sql_res[0][0]: # 登录成功
obj = redirect('/onlineMarket/home/')
obj.set_cookie('token', True, 3600)
obj.set_signed_cookie('user', Username, salt='WaL')
print('用户{}已登录'.format(Username))
return obj
else:
request.session['message'] = '密码错误'
request.session.set_expiry(1)
return redirect('/onlineMarket/login/')
运行结果及报错内容
File "D:\解压\解压文件\个人作品\OnlineMarket\OnlineMarket\servers\views.py", line 105, in login
elif Password == sql_res[0][0]: # 登录成功
TypeError: 'NoneType' object is not subscriptable