[mod_python] Mod_python quit working

Graham Dumpleton grahamd at dscpl.com.au
Fri Jan 14 18:27:11 EST 2005


On Friday, January 14, 2005, at 05:36  PM, Bo Lorentsen wrote:

> Graham Dumpleton wrote:
>
>> Now, can we go backwards on this a bit and try and debug this in a 
>> more
>> sensible way.
>>
> Hi, I have tried the same problem too ... and the reason was a 
> conflict between too versions of libs (indirect loaded by python 
> modules), loaded into apache.
>
> So my first question must be ... how does a simple "hello, world" 
> work, and if it work, what kind of module do you import ?

Do you really want to know "how does it work", or how to set one up?

The documentation has a description of setting up a test at:

   http://www.modpython.org/live/current/doc-html/inst-testing.html

I just wish that this would describe the handler as shown in:

   http://www.modpython.org/live/current/doc-html/pyapi-handler.html

Ie., return an explicit content type so that one isn't at the
mercy of how Apache may be configured for its default content
type when none is defined.

Another trap is that people read this 3.1.X documentation and
try it with 2.7.X and find it doesn't work as necessarily as
expected if they modify it to return HTML. This is because in 3.1.X
it will automatically flush out headers when first write()
occurs whereas with 2.7.X you have to flush them explicitly.
There is also the fact that in 2.7.X you must use python-program
and not mod_python when using AddHandler/SetHandler.

Anyway, occurs to me that it would make a great deal of sense to
include with mod_python module itself some test handlers. Thus,
instead of relying on people to create their own test handler when
first checking to see if their installation works, have them point
at that included in mod_python itself. Ie.,

     <Directory /some/directory/htdocs/test>
         SetHandler mod_python
         PythonHandler mod_python.testing
         PythonDebug On
     </Directory>

One could actually provide a number of different tests for different
basic functionality of mod_python. The default could be a really
basic test, but others selected by using "::name", could return
information from the "req" object, interpreters or Apache state
and config etc. One might even be able to have tests for Session's
and other higher level functionality.

By including some inbuilt tests like this, you avoid issues arising
because of people not following the instructions properly as to where
to put the "mptest.py" content handler and what to put in it.

Anyone think this is a reasonable suggestion? any suggestions as to
some useful basic test handlers which could be created? Wouldn't be
too hard to bring a few such tests together into a simple package
which gets installed under mod_python.testing. Initially this could
be standalone but might be incorporated into mod_python proper later.


--
Graham Dumpleton (grahamd at dscpl.com.au)



More information about the Mod_python mailing list