[mod_python] PythonConnectionHandler directive

Gregory (Grisha) Trubetskoy grisha at modpython.org
Mon Dec 15 22:37:51 EST 2003


I think the problem is the python path. Try making sure that the directory
where protocol.py is located is added to PythonPath:

PythonPath "sys.path+['/var/www/nunatak']"

Since this is a connection handler, the DocumentRoot is irrelevant and
the path in it has no effect.

Grisha

On Tue, 16 Dec 2003, Timothy Stebbing wrote:

> 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
>
>
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>


More information about the Mod_python mailing list