This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` | |
Django sends broken links by mail using built in middleware "BrokenLinkEmailsMiddleware". | |
This class alters that functionality and sends broken links to logger. | |
``` | |
class BrokenLinkLogMiddleware(BrokenLinkEmailsMiddleware): | |
def process_response(self, request, response): | |
"""Log broken link for relevant 404 NOT FOUND responses.""" | |
if response.status_code == 404 and not settings.DEBUG: |