我正在制作网页。有两种观点。Index和Detail。在索引中,我使用response.set_cookie('key', key)where 为用户设置cookie response = HttpResponseRedirect(file_url)。在detail功能,当我尝试利用cookie的获取数据
if 'key' not in request.cookies:
key = request.COOKIES['key']
Run Code Online (Sandbox Code Playgroud)
我收到错误消息:'WSGIRequest' object has no attribute 'cookies'。详细的错误链接:http : //dpaste.com/1P017V6
请帮我!。提前致谢。
您输入了request.cookies,但cookies必须为大写。试试这个:
if 'key' not in request.COOKIES:
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2031 次 |
| 最近记录: |