gpt4 book ai didi

python - 'WSGIRequest' 对象没有属性 'cookies'

转载 作者:太空宇宙 更新时间:2023-11-03 13:38:46 25 4
gpt4 key购买 nike

我正在制作一个网页。有两种看法。 索引详细信息。在索引中,我使用 response.set_cookie('key', key) 为用户设置 cookie,其中 response = HttpResponseRedirect(file_url)。在 detail 函数中,当我尝试使用

从 cookie 中获取数据时
   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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com