Last active
September 14, 2016 10:09
-
-
Save nwjlyons/7487f9943311f038cd4a459e03faba4b to your computer and use it in GitHub Desktop.
Don't log if path starts with /static/
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
from django.core.servers.basehttp import WSGIRequestHandler | |
# Grab the original log_message method. | |
_log_message = WSGIRequestHandler.log_message | |
def log_message(self, *args): | |
# Don't log if path starts with /static/ | |
if self.path.startswith("/static/"): | |
return | |
else: | |
return _log_message(self, *args) | |
# Replace log_message with our custom one. | |
WSGIRequestHandler.log_message = log_message | |
# Import the original runserver management command | |
from django.core.management.commands.runserver import Command |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hat tip https://code.djangoproject.com/ticket/25704