import sys from django.core.handlers.base import BaseHandler class NoPasswordExceptionMiddleware(): def process_exception(self, request, exception): if 'password' in request.POST.keys(): post = request.POST.copy() post['password']='********************' request.POST = post b=BaseHandler() exc_info = sys.exc_info() b.handle_uncaught_exception(request,exception,exc_info)