Just drop this middleware (a single
python file) into your project, include it in your settings file (near
the end, but before gzip), and any time a page does not validate, this
middleware will send back a 500 error page containing the output from
validate and the html source annotated with line numbers.
This does not put anything into your database, it just squawks if you get a validation error.
This has a similar goal to a more ambitious project by Luke Plant, but I had much simpler needs and wanted to take the opportunity to write a small Django middleware.
Announcement posted to django-users list.