[wingide-users] debugging mod_wsgi application (Trac)

Jason Galyon jtgalyon at gmail.com
Wed Oct 8 08:25:11 MDT 2008


I am trying out the multi-repository branch (synced often with trunk) of
Trac.  I would like to debug some plugins with Wing.

I am running on Ubuntu 8.04 using Apache mod_wsgi calling the wsgi file
I pasted below with the (*) showing my breakpoint.


I used the instructions here (http://wingware.com/doc/howtos/mod_python)
as the basis for my approach.  As the apache process runs as the default
'www-data' user, I have copied my wingdebugpw file to (just in case)
both the calling script's (trac.wsgi) directory as well as the same
directory as the wingdbstub.py file.

However, I can not get the debugger to 'fire' or at least the IDE is not
picking it up.  I have set the logging to verbose, but nothing is ever
logged.  However, if I remove the test (below) for if the
wingdbstub.debugger != None, then I get an exception for NoneType not
having a StartDebug() attribute.  Why is there never an instance of
debugger?

--------------
trac.wsgi:
#!/usr/bin/python
import sys
sys.stdout = sys.stderr

import os

#os.environ['TRAC_ENV_PARENT_DIR'] = '/usr/local/trac-multirepos/sites'
os.environ['TRAC_ENV'] = '/usr/local/trac-multirepos/sites/master'
os.environ['PYTHON_EGG_CACHE'] = '/usr/local/trac-multirepos/eggs'

from trac import wingdbstub
if wingdbstub.debugger != None:
    wingdbstub.debugger.StartDebug()
(*)import trac.web.main
(*)application = trac.web.main.dispatch_request

Any tips?

Thanks,
Jason


More information about the wingide-users mailing list