Debugging mod_python
Today I had a small interesting project I didn't quite complete, but should do in the morning its adding in a python authentication wrapper pulling from our LDAP server so that we can control our SVN and Trac access. We've already sort of got one, but it requires LDAP munging to move people around and instead we are moving that up to Python and so may as well give it a web interface in Django.
Some of the things I learned:
- mod_python has a very useful handler called
PythonAuthenHandler
that allows you to just plugin a directive to get a peice of Python to handle authentication - documentation is online. - There's a sample in the Django docs of using this handing directive.
- When it doesn't work you can get to a pdb in mod_python, called PythonEnablePdb, that is documented here.
- You will then need to start Apache using
-DONE_PROCESS
and then you get a pdb and bob is your uncle.
Until you realise the LDAP data is dodgy. Tthere I was about to jump ship to mod_wsgi, but got the job done for now (almost)