def process_response(self, request, response): if settings.DEBUG: if request.GET.has_key('mem_prof'): import guppy out = StringIO() heapy = guppy.hpy() out.write(str(heapy.heap())) out.write('\n\n\n\n') out_str = out.getvalue() if response and response.content and out_str: response.content = "<pre>" + out_str + "</pre>" elif request.GET.has_key('mem_on'): from guppy.heapy.Remote import on on() elif request.GET.has_key('mem_off'): from guppy.heapy.Remote import off off() return response
# Start a remote monitoring enabling thread, # unless I am that thread myself. from guppy.heapy.Remote import on on()