views:

25

answers:

1

When Django is up, it handles 500 errors. When Django is screwed, mod_python will throw a bare bones "Internal Server Error." This is described well in the docs at the following link:

http://docs.djangoproject.com/en/dev/howto/deployment/modpython/#error-handling

My question: Is there a way to override that "Internal Server Error" page without overriding all Django 500 pages? The only way I can find to override it is by screwing around with Apache's ErrorDocument setting, which will then override all 500s, whether handled by Django or Apache.

Is there a way to negotiate that so Django handles Django errors, but still customize the default message? I would love to know.

Thanks in advance!

A: 

For that VirtualHost or that configuration, you can specify the Apache HTTP 500 Error. Implementing custom error messages is easy

Just add the line to your apache configuration

ErrorDocument 500 http://www.example.com/error_500.html 

For more information: http://httpd.apache.org/docs/2.0/custom-error.html

Andrew Sledge
Andrew, thanks for the tip. I've done what you said, and it works. But the downside is that it seems to override *all* 500 errors, even those that Django usually serves that are unrelated to the config issue. I'm looking for a solution that will only fire in a "pre-Django" error, like the one described in the link above, and all Django handle more "typical" 500 errors.
palewire