Django - SuspiciousOperation,请求会话已删除

时间:2018-04-20 17:31:26

标签: python django session

我收到此错误,我不明白为什么:

SuspiciousOperation at /file/path/

The request's session was deleted before the request completed. 
The user may have logged out in a concurrent request, for example.

我知道用户没有注销(首先没有帐户登录)。

当我调用request.session并尝试提取已存储的某些图表数据时,我的一个视图中出现错误。它导致我的图表无法在页面上显示,因为它无法及时提取数据。

这是堆栈跟踪:

/opt/name/env/lib/python2.7/site-packages/django/core/handlers/base.py in get_response
131.   response = middleware_method(request, response)

/opt/name/env/lib/python2.7/site-packages/django/contrib/sessions/middleware.py in process_response
61.    "The request's session was deleted before the "

知道我在这里做错了什么吗?

编辑 - 在发生错误的代码中:::

def exmaple_function(request, name):
    response = request.session['key']['key'][name]
    return HttpResponse(response, content_type="text")

有趣的是,这些错误只发生在我的网站制作版本上 - 而不是我的本地测试版或沙盒版本。

0 个答案:

没有答案