[Answer]-How to store/deal with django exception webpages in acceptance testing

1👍

If you did this with Django’s testing client, you could get more concise information–but by using requests, you’re really hitting your page as a web browser would, so the full page is what you get (but 65K for a 500 Error page? Wow).

Could you embed in the error page an HTML comment with a marker and concise explanation?

<html>
  <h1>Error</h1>
  ... 64k of stuff follows ...
  <!-- ERR:"info about error" -->    
  </html>

That way, you could parse the results for that error code and store just that.

Of course, you’ll want to make sure you don’t put anything confidential in that error message or, if you do, that you emit it only when in DEBUG mode or when the request comes from localhost, or logged in as staff, or whatever other security constraint would work.

Slightly prettier would be to write a piece of middleware that emits the error-info as an HTTP Header; then your page could stay the same and you could look at the response headers for your error info.

Leave a comment