My favorites | Sign in
Project Home Downloads Issues
Project Information
Members

The basic idea is to be able to view debugging infomation for a single user in production

As you know most of the django real life appliaction runnning on apache server.

in a production you do not want to log debug information to a file and you also want to debug infomation to a specific user.

So the middleware basic idea is to detect a pre defined useranegt or a list of IP's that will enable the output of debug information that was set in the "views" and append this data to the html page that is generated.

And you just need to view source in the browser.

Install

How to use it

  • in django settings file add to MIDDLEWARE_CLASSES tuple django.contrib.debug.middleware.DebugView
  • add to django views file from django.contrib.debug.middleware import append_debug_info
  • use the function append_debug_info(request,key,value) to add debug data to the request object

Configure ( in django settings.py file)

  • To enable useragnet filter
  • DEBUG_USER_AGENT = 'My Site Debug UserAgent'
  • To enable ip filter
  • DEBUG_IP_LIST = ('127.0.0.1','192.168.2.108')
  • Change Default rendering method
  • def my_rendering_method(debug_info=None):
        if debug_info == None: return ''
        return '<!-- Debug Info '+str(debug_info) + ' -->'
    
    RENDERING_METHOD = my_rendering_method

How to change UserAgent

Powered by Google Project Hosting