[mod_python] PythonConnectionHandler directive

Timothy Stebbing tim.stebbing at nunatak.com.au
Tue Dec 16 12:30:34 EST 2003


Howdy,

Im trying to get a simple protocol handler running, yet apache does not 
seem to be calling my code.

I have this in my apache config, this starts without any errors:

Listen 192.168.0.18:4444
<VirtualHost 192.168.0.18:4444>
        ServerAdmin webmaster at localhost
        DocumentRoot /var/www/nunatak/
        ErrorLog /tmp/test-error.log
        LogLevel debug
        PythonConnectionHandler protocol
</VirtualHost>

in /var/www/nunatak/protocol.py:

from mod_python import apache
 
def connectionhandler(conn):
    conn.write("Hello!")
    f = open("/tmp/foo.log", "w+")
    f.write("foo happened!\n")
    f.close()
    return apache.OK

when I telnet to localhost 4444 I get:

Trying 192.168.0.18...
Connected to balrog.localnet.
Escape character is '^]'.
Connection closed by foreign host.

I have no /tmp/foo.log at all, which makes me think the script has not 
been located/run

in my ErrorLog for the virtual host I have:
[Tue Dec 16 23:26:23 2003] [error] python_connection: 
ConnectionDispatch() returned nothing.


Im guessing its a problem with my virtualhost definition not being set 
up correctly, but in the docs
for mod_python there is not much more info on this subject.

-tjs




More information about the Mod_python mailing list