Django 抛出错误 'WSGIRequest' 对象没有属性 'push'

Django throws error 'WSGIRequest' object has no attribute 'push'

当我 运行 django 服务器并加载索引页面时,它说 ...

错误:

'WSGIRequest' object has no attribute 'push'.

这是我的代码

def index(request):
    context_dict = {'boldmessage': "anything can b written here"}
    return render_to_response('rango/index.html', context_dict, request)

在 return 时删除请求 .. 应该是

return render_to_response('rango/index.html',context_dict)

或改用渲染

return render(request, 'rango/index.html', context_dict)

注:

render() is the same as a call to render_to_response() with a context_instance argument that that forces the use of a RequestContext.