From 8a86e7713f26f6e91a9a25615073321b9dd842eb Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Tue, 26 Jul 2005 17:49:49 +0000 Subject: [PATCH] Fixed #161 -- Log output for 'django-admin runserver' no longer includes admin media git-svn-id: http://code.djangoproject.com/svn/django/trunk@320 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/core/servers/basehttp.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/django/core/servers/basehttp.py b/django/core/servers/basehttp.py index 11f179faf3..8e1ba39e6b 100644 --- a/django/core/servers/basehttp.py +++ b/django/core/servers/basehttp.py @@ -530,6 +530,12 @@ class WSGIServer(HTTPServer): class WSGIRequestHandler(BaseHTTPRequestHandler): server_version = "WSGIServer/" + __version__ + + def __init__(self, *args, **kwargs): + from django.conf.settings import ADMIN_MEDIA_PREFIX + self.admin_media_prefix = ADMIN_MEDIA_PREFIX + BaseHTTPRequestHandler.__init__(self, *args, **kwargs) + def get_environ(self): env = self.server.base_environ.copy() env['SERVER_PROTOCOL'] = self.request_version @@ -579,6 +585,12 @@ class WSGIRequestHandler(BaseHTTPRequestHandler): handler.request_handler = self # backpointer for logging handler.run(self.server.get_app()) + def log_message(self, format, *args): + # Don't bother logging requests for admin images or the favicon. + if self.path.startswith(self.admin_media_prefix) or self.path == '/favicon.ico': + return + sys.stderr.write("[%s] %s\n" % (self.log_date_time_string(), format % args)) + def run(port, wsgi_handler): server_address = ('', port) httpd = WSGIServer(server_address, WSGIRequestHandler)