mirror of https://github.com/django/django.git
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
This commit is contained in:
parent
ba3db4ca38
commit
8a86e7713f
|
@ -530,6 +530,12 @@ class WSGIServer(HTTPServer):
|
||||||
|
|
||||||
class WSGIRequestHandler(BaseHTTPRequestHandler):
|
class WSGIRequestHandler(BaseHTTPRequestHandler):
|
||||||
server_version = "WSGIServer/" + __version__
|
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):
|
def get_environ(self):
|
||||||
env = self.server.base_environ.copy()
|
env = self.server.base_environ.copy()
|
||||||
env['SERVER_PROTOCOL'] = self.request_version
|
env['SERVER_PROTOCOL'] = self.request_version
|
||||||
|
@ -579,6 +585,12 @@ class WSGIRequestHandler(BaseHTTPRequestHandler):
|
||||||
handler.request_handler = self # backpointer for logging
|
handler.request_handler = self # backpointer for logging
|
||||||
handler.run(self.server.get_app())
|
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):
|
def run(port, wsgi_handler):
|
||||||
server_address = ('', port)
|
server_address = ('', port)
|
||||||
httpd = WSGIServer(server_address, WSGIRequestHandler)
|
httpd = WSGIServer(server_address, WSGIRequestHandler)
|
||||||
|
|
Loading…
Reference in New Issue