Search code examples
pythondjangowsgirender-to-response

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


When I run the django server and load the index page it says ...

Error:

'WSGIRequest' object has no attribute 'push'.

This is my code

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

Solution

  • remove the request when return .. It's should be

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

    or use render instead

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

    Note:

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