I have a simple working wsgi app. I can successfully return whatever HTTP status code, headers, and HTML I want. What I would like to do, is that when I'm returning a status code other than '200 OK', for WSGI to let apache fall back to its error handling and display whatever page apache is configured to display according to its 'ErrorDocument' setting.
For example, this works fine when my WSGI app crashes unintentionally, then I see the default 'internal server error' page from apache.
My question is, how can I do this in a controlled, deliberate manner? For example, I can then do my own authentication, and fallback to the default apache page I have set up.
Any ideas?
Presuming you actually mean with mod_wsgi under Apache, ensure you are using mod_wsgi daemon mode and set:
There is a brief mention of this in mod_wsgi version 3.0 release notes.
http://code.google.com/p/modwsgi/wiki/ChangesInVersion0300
If you are using Apache as proxy in front of distinct Python web server running WSGI application, then use Apache ProxyErrorOverride directive instead.