Debugging Django code on mod_wsgi (how to access ['wsgi.errors'])

I start by developing Django code on a server running on top of Apache / mod_wsgi.

I want to understand a few things:

  • What methods are commonly used to debug applications running on the server?

  • In particular, I'm trying to just use Debug "print" for now. But I cannot seem that printed statements work. I print to stderr, but I'm not sure which log file should look. According to this , I have to use environ['wsgi.errors'] , but how do I get access to this from my Django code?

Thanks!

EDIT:. By the way, adding the line print >> sys.stderr, 'message ...' not only does not print a single log file, this leads to the fact that parts of my application simply do not load.

+6
debugging django web-applications apache mod-wsgi
source share
1 answer
  • Try using the django debug toolbar . This can greatly help in debugging when you cannot use the debugger.

    Indeed, although debugging should be done on your development machine. I have yet to see a problem with the code in django, which also did not occur in my dev block.

  • Usually you cannot type in mod_wsgi. Use logging instead. This is really what you want and the debug toolbar will show you the log instructions on the page, so you don’t even need to look at the file.

+5
source share

All Articles