URL: https://pypi.org/project/django-html-validator/

django-html-validator is a Django project that can validate your generated HTML. It does so by sending the HTML to https://html5.validator.nu/ or you can start your own Java server locally with vnu.jar from here. The output is that you can have validation errors printed to stdout or you can have them put as .txt files in a temporary directory. You can also include it in your test suite and make it so that tests fail if invalid HTML is generated during rendering in Django unit tests.

The project seems to have become a lot more popular than I thought it would. It started as a one-evening-hack and because there was interest I wrapped it up in a proper project with "docs" and set up CI for future contributions.

I kinda of forgot the project since almost all my current projects generate JSON on the server and generates the DOM on-the-fly with client-side JavaScript but apparently a lot of issues and PRs were filed related to making it work in Django 2.x. So I took the time last night to tidy up the tox.ini etc. and the necessary compatibility fixes to make it work with but Django 1.8 up to Django 2.1. Pull request here.

Thank you all who contributed! I'll try to make a better job noticing filed issues in the future.

Comments

Your email will never ever be published.

Previous:
Quick dog-piling (aka stampeding herd) URL stresstest August 10, 2018 Python
Next:
Django lock decorator with django-redis August 14, 2018 Python, Web development, Django, Redis
Related by category:
A Python dict that can report which keys you did not use June 12, 2025 Python
Native connection pooling in Django 5 with PostgreSQL June 25, 2025 Django, Python
How I run standalone Python in 2025 January 14, 2025 Python
How to resolve a git conflict in poetry.lock February 7, 2020 Python
Related by keyword:
How much faster is Cheerio at parsing depending on xmlMode? December 5, 2022 Node, JavaScript
Fastest way to turn HTML into text in Python January 8, 2021 Python
django-html-validator October 20, 2014 Python, Web development, Django
Interesting float/int casting in Python April 25, 2006 Python