Ticket #116: django-admin-media-log.patch

File django-admin-media-log.patch, 865 bytes (added by Vsevolod Novikov, 13 years ago)

I've made a simple patch which allows to setup admin media logging easy. It adds optional ADMIN_MEDIA_LOG setting, and developer can see admin media requests if this settings is set to True

  • django/core/servers/basehttp.py

     
    133133
    134134    def log_message(self, format, *args):
    135135        # Don't bother logging requests for admin images or the favicon.
    136         if (self.path.startswith(self.admin_media_prefix)
    137                 or self.path == '/favicon.ico'):
     136        from django.conf import settings
     137        if (    not (hasattr(settings,'ADMIN_MEDIA_LOG') and
     138                    settings.ADMIN_MEDIA_LOG)
     139                and
     140                    (self.path.startswith(self.admin_media_prefix) or
     141                    self.path == '/favicon.ico')
     142            ):
    138143            return
    139144
    140145        msg = "[%s] %s\n" % (self.log_date_time_string(), format % args)
Back to Top