我正在制作一个网页。有两种看法。 索引
和详细信息
。
在索引中,我使用 response.set_cookie('key', key)
为用户设置 cookie,其中 response = HttpResponseRedirect(file_url)
。在 detail
函数中,当我尝试使用
if 'key' not in request.cookies:
key = request.COOKIES['key']
我收到错误消息:'WSGIRequest' 对象没有属性 'cookies'
。
详细错误链接:http://dpaste.com/1P017V6
请帮帮我! 提前致谢。
最佳答案
您键入了 request.cookies
,但 cookies
必须大写。试试这个:
if 'key' not in request.COOKIES:
关于python - 'WSGIRequest' 对象没有属性 'cookies',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35318353/