[Fixed]-Django media url is not resolved in 500 internal server error template

11👍

The 500 error handler doesn’t pass a RequestContext to the template, it just uses a Context. As you may know, MEDIA_URL is added in a context processor, which are only included when you use a RequestContext.

You can set your own 500 handler and pass a RequestContext if you want.

Here’s a link to the django docs on making a custom handler500.

👤Seth

3👍

The django docs recommend that you do not use a template for your 500.html file because there is no way of dealing with an error in the rendering of that template.

Just stick with a straight HTML file informing the user that there has been an error. That’s all they need to know.

You can look at the server logs for what you need to know.

Leave a comment