mod_python

P

Python_it

Today I was busy to install mod_python.

I have put the line

LoadModule python_module libexec/mod_python.so

into the httpd.conf file.
It Works!
Apache load mod_python /3.2.2.b Python2.4

But my problem is where I have to place te following code in de
httpd.conf?

<Directory C:\Program Files\Apache Group\Apache2\htdocs\project\>
AddHandler mod_python .py
PythonHandler mptest
PythonDebug On
</Directory>

Because al the tutorials write this. But where?

If I try to put the code some where,
apache give the following message by testing the configure:
Multiple <Directory> arguments not (yet) supported
But what i have to change or replace.

I test with the next file:

C:\Program Files\Apache Group\Apache2\htdocs\project\
mptest.py

from mod_python import apache

def handler(req):
req.content_type = 'text/plain'
req.send_http_header()
req.write('mptest.py\n')
return apache.OK

Is this code enough for testing?
 
D

deelan

Python_it wrote:
(...)
But my problem is where I have to place te following code in de
httpd.conf?

<Directory C:\Program Files\Apache Group\Apache2\htdocs\project\>
AddHandler mod_python .py
PythonHandler mptest
PythonDebug On
</Directory>

Because al the tutorials write this. But where?

try put it at the end of your http.conf file.
>
> If I try to put the code some where,
> apache give the following message by testing the configure:
> Multiple <Directory> arguments not (yet) supported
> But what i have to change or replace.

just an idea, try:

<Directory "C:\Program Files\Apache Group\Apache2\htdocs\project">
....
</Directory>

because it sounds like apache parser gets confused
with all those slashes.
I test with the next file:

C:\Program Files\Apache Group\Apache2\htdocs\project\
mptest.py

from mod_python import apache

def handler(req):
req.content_type = 'text/plain'
req.send_http_header()
req.write('mptest.py\n')
return apache.OK

Is this code enough for testing?

i believe so.

also check this:
"Getting mod_python Working"
<http://www.dscpl.com.au/articles/modpython-001.html>
 
P

Python_it

Thanks for your replay.
I put the handler code at the end of the file.
No error!
But if I go to my localhost\project\mptest.py
The code of my function appears.
I solve this by put the following code in the confige file:

<Directory ..........>
AllowOverride FileInfo
</Directory>
 
P

Peter

deelan said:
Python_it wrote:
(...)



try put it at the end of your http.conf file.




just an idea, try:

<Directory "C:\Program Files\Apache Group\Apache2\htdocs\project">
...
</Directory>

because it sounds like apache parser gets confused
with all those slashes.
I could be wrong, but i think i read something about apache expecting
you to use forward slashes instead of backslashes when i was using
windows...
I seem to recall it being in the readme. ...?
i believe so.

also check this:
"Getting mod_python Working"
<http://www.dscpl.com.au/articles/modpython-001.html>
HTH,
Peter
 
J

Jim Gallacher

Python_it said:
Today I was busy to install mod_python.

I have put the line

LoadModule python_module libexec/mod_python.so

into the httpd.conf file.
It Works!
Apache load mod_python /3.2.2.b Python2.4

But my problem is where I have to place te following code in de
httpd.conf?

<Directory C:\Program Files\Apache Group\Apache2\htdocs\project\>
AddHandler mod_python .py
PythonHandler mptest
PythonDebug On
</Directory>

Because al the tutorials write this. But where?

If I try to put the code some where,
apache give the following message by testing the configure:
Multiple <Directory> arguments not (yet) supported
But what i have to change or replace.

Your problem is not related to the location of the <Directory> section.
Apache doesn't like spaces in <Directory>, so try quoting your path.
Also, the Apache docs state that "forward slashes should always be used
as the path separator in Apache, even for Windows".

So try the following in your config file:
said:
I test with the next file:

C:\Program Files\Apache Group\Apache2\htdocs\project\
mptest.py

from mod_python import apache

def handler(req):
req.content_type = 'text/plain'
req.send_http_header()
req.write('mptest.py\n')
return apache.OK

Is this code enough for testing?

Yes.

You are more likely to get timely help on the mod_python mailing list.
See http://www.modpython.org/ for subscription information. Personally I
only read c.l.p when I'm looking for cheap entertainment. Some people on
this list just crack me up. :)

Regards,
Jim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,058
Latest member
QQXCharlot

Latest Threads

Top