[Django]-Django 500.html template not used for internal server error on Amazon Elastic Beanstalk

4👍

I had a similar problem once because I was using context variables in my 500.html template. But by default Django does not provide any context to the 500 error page. So that leads to a “double” error, where the rendering the error page itself creates an error.

From the Django documentation:

The default 500 view passes no variables to the 500.html template and
is rendered with an empty Context to lessen the chance of additional
errors.

https://docs.djangoproject.com/en/dev/topics/http/views/#the-500-server-error-view

So if you use any context variables in your 500 error page, that’s probably what happened. Not sure if this helps in your case though…

If that was the problem, the solution would be to write a custom error handling view with a minimal context to render static files etc (as described in the documentation above).

Leave a comment