While in development, I managed to redirect traceback messages (which by default appeared in the local console) to the client's browser console with some custom middleware.
However, when doing this, the traceback no longer displays in the console. Is there a way to have it both in the local console, and in the client's browser?
The middelware used (based on solutions from here and here):
import traceback
from django.http import HttpResponse
class ErrorMiddleware(object):
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
return self.get_response(request)
def process_exception(self, request, exception):
tb = traceback.format_exc()
return HttpResponse(tb)