Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #161 -- Log output for 'django-admin runserver' no longer inclu…

…des admin media

git-svn-id: http://code.djangoproject.com/svn/django/trunk@320 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 8a86e7713f26f6e91a9a25615073321b9dd842eb 1 parent ba3db4c
Adrian Holovaty adrianholovaty authored
Showing with 12 additions and 0 deletions.
  1. +12 −0 django/core/servers/basehttp.py
12 django/core/servers/basehttp.py
View
@@ -530,6 +530,12 @@ def set_app(self,application):
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 @@ def handle(self):
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)
Please sign in to comment.
Something went wrong with that request. Please try again.