This is a follow up question from: How do I make a loading page while I am processing something in the backend with Django?
I am performing some calculations in the view method. Thus it takes 2~4 seconds to initiate a return statement from my view.py's function verify_api().
I get internal server error when the web application has been deployed to heroku.
From heroku logs :
2015-05-15T21:35:47.907877+00:00 heroku[router]: at=info method=GET path="/verify_api" host=todjoke.herokuapp.com request_id=1765d59f-e57e-4f6c-b75e-1552023f8e9c fwd="120.59.184.32" dyno=web.1 connect=1ms service=825ms status=500 bytes=11821
This is the return statement from my view.py , verify_api() :
if valid :
print 'True'
return HttpResponse(json.dumps({'success': 'True',}), status = 200, content_type='application/json')
else:
return HttpResponse(json.dumps({'success': 'False'}), status = 400, content_type='application/json')
For debugging I tried printing out stuff as the computation is being done and what I observed from heroku logs was the computation stops in the middle of the process and sends internal server error 500 .
How can I avoid this internal server error and get a response from my verify_api() method inside my view.py.
Note: This request works fine in local development mode inside my machine with ./manage runserver. [I never get 500 response error in local development]