WSGI servers such as Werkzeug pass callable methods that should NOT be called when the META structure is printed in places such as the debug response handler. http://werkzeug.pocoo.org/docs/serving/#shutting-down-the-server
When a Django view throws an error (with DEBUG=True) and is hosted by Werkzeug, it causes the server to silently shut down because the Django error page is blindly calling the shutdown method in order to pretty print the result for the error page.
mark methods passes through wsgi META with do_not_call_in_templates
This also needs a ticket and test.
Merge remote-tracking branch 'origin/master'
updated test case to confirm META do_not_call_in_templates
test all META values for do_not_call_in_templates
Hm. I'm not sure this is a such a good idea. It requires an iteration through META on every request, whether or not you're actually using Werkzeug. I don't like the idea of adding an overhead that everyone has to pay because of a side effect in the way Werkzeug works. I don't know that I have a better solution, but right now I'm -1 on merging this.
I agree that this is a bit wonky for Werkzeug to be passing a callabale in the environ dict, but it's unacceptable for Django to be blindly invoking that callable at any point. How about one of the following options:
a) iterate through the META structure only when DEBUG==True
b) delay iteration until we enter the debug handler view
My vote is for option b. Thoughts?
Since this has a -1 from jacob and clearly needs more discussion, please open a ticket and discuss there and then reopen a new pull request with the decided solution (if at all)