Django W3C Validator
Django W3C Validator is a pluggable Django app that validates all your urls using the W3C validator. It is called via a management command that crawls your domain for all internal links using Mechanize and saves them to a text file to reuse. It then sends each url to the W3C validator and saves the results in an html file to view on your website.
Pip install from GitHub:
pip install git+git://github.com/racheltwu/django_w3c_validator
INSTALLED_APPSin your settings file:
INSTALLED_APPS = ( ... 'django_w3c_validator', ... )
You can either set the
VALIDATOR_START_URLvariable in your settings file, or if you already have your domain set in
ALLOWED_HOSTSit will pull the first domain from that tuple.
VALIDATOR_START_URLhas priority, and it doesn't matter if you start with "http://" or not, nor does it matter if you use the ".example.com" method in
ALLOWED_HOSTSto include subdomains. Subdomain urls would be considered internal during the crawling process and would be included to be validated.
VALIDATOR_START_URL = 'example.com'
VALIDATOR_COLLAPSEto False in your settings. It is True by default.
Run the managagement command to validate all the internal urls on your site:
python manage.py validate_html
The command will detect your domain name from your settings
file and proceed to crawl it for all internal links, and save all found urls to a text file to use again later. If this file
already exists, it will not crawl the site again unless you pass the
--crawl option with the command.