diff --git a/util/middleware.py b/util/middleware.py index 3bda2c7873..fe73e67c7b 100644 --- a/util/middleware.py +++ b/util/middleware.py @@ -1,5 +1,6 @@ import logging +from django.conf import settings from django.http import HttpResponse log = logging.getLogger("mitx") @@ -8,6 +9,7 @@ class ExceptionLoggingMiddleware(object): """Just here to log unchecked exceptions that go all the way up the Django stack""" - def process_exception(self, request, exception): - log.exception(exception) - return HttpResponse("Server Error - Please try again later.") + if not settings.TEMPLATE_DEBUG: + def process_exception(self, request, exception): + log.exception(exception) + return HttpResponse("Server Error - Please try again later.")