[mod_python] [SPAM] Re: mod_python installation failure on apache

Martin (gzlist) gzlist at googlemail.com
Fri May 9 17:58:51 EDT 2008


On 09/05/2008, Martin (gzlist) <gzlist at googlemail.com> wrote:
>  An even simpler test to see if you've got the basic installation right
>  is to add to your httpd.conf file:
>
>  # with the module imported further up:
>  #LoadModule python_module modules/mod_python.so
>  <Location /mpinfo>
>
>         SetHandler mod_python
>         PythonHandler mod_python.testhandler
>
>         Order deny,allow
>         Deny from all
>
>         Allow from 127.0
>  </Location>
>
>  Restart, then visit http://localhost/mpinfo as see if you get the page.

Sorry, didn't mean to suggest this when you've obviously already got
that far from the first email. Got distracted looking at the the
second one and clearly had a brain-collapse.

Looking at the httpd.conf from the bottom of that readout, it seems
(though it's rather hard to tell with the hilarious lack of html
escaping in the info handler) you've got pretty much what the tutorial
asks for. However, I suspect you've got the Directory wrong. You need
to give it as either an absolute path, or relative to the server root
(not document root!).

# WRONG # <Directory /test>
<Directory C:/apache/htdocs/test> # RIGHT #

Attached a from-blank httpd.conf that works for me with ServerRoot as
"C:/Program Files/Apache2.2/" DocumentRoot as "C:/Program
Files/Apache2.2/htdocs" and the script at "C:/Program
Files/Apache2.2/htdocs/test/mptest.py", which might help get going.

Don't know what the tutorial persists with the CGI confusion between
running a script, and fetching a resource, SetHandler really is a
better way.

Martin
-------------- next part --------------

LoadModule authz_host_module modules/mod_authz_host.so
LoadModule mime_module modules/mod_mime.so
LoadModule python_module modules/mod_python.so

Listen 80

ErrorLog logs/error.log

DocumentRoot htdocs

<Directory />
	Options None
	AllowOverride None
	Order deny,allow
	Deny from all
	Allow from 127.0
</Directory>

PythonOption mod_python.importer.path "['htdocs/test']"
PythonDebug On

<Location /mpinfo>
	SetHandler mod_python
	PythonHandler mod_python.testhandler
</Location>

<Location /mptest>
	SetHandler mod_python
	PythonHandler mptest
</Location>

# This is wrong, would give you the script as text
#<Directory /test>
#	AddHandler mod_python .py
#	PythonHandler mptest
#</Directory>

# This is the right way
<Directory htdocs/test>
	AddHandler mod_python .py
	PythonHandler mptest
</Directory>


More information about the Mod_python mailing list