Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Apache 2.2.3 and mod_python 3.2.10

Reply
Thread Tools

Apache 2.2.3 and mod_python 3.2.10

 
 
m.banaouas
Guest
Posts: n/a
 
      12-19-2006
I installed Apache 2.2.3 and mod_python 3.2.10 on WinXP plateform
I configured mod_python via httpd.conf:
LoadModule python_module modules/mod_python.so

but my script folder configuration doesn't work correctely:

Alias /myfolder D:/myfolder

<Directory "/myfolder">
Order allow,deny
Allow from all
AddHandler mod_python .py
PythonHandler mod_python.publisher
PythonDebug On
</Directory>

for test, this is a sample script d:\myfolder\test.py
# test.py
#
from mod_python import apache
#
def hello(name=None):
if name:
return 'Hello, %s!' % name.capitalize()
else:
return 'Hello there!'
#
def handler(req):
req.content_type = 'text/plain'
req.write("from handler test, Hello World!")
return apache.OK

when I access to the url http://localhost/monrep/test.py,
I obtain source test.py listing but not the rendering of handler or
hello method.

with url http://localhost/theriaque/test.py/hello, I obtain :
=>The requested URL /theriaque/test.py/hello was not found on this server.

It seems like something is missing ... but what ?

thanks for any help
 
Reply With Quote
 
 
 
 
m.banaouas
Guest
Posts: n/a
 
      12-19-2006
sorry, I give here the right paths:

I installed Apache 2.2.3 and mod_python 3.2.10 on WinXP plateform
I configured mod_python via httpd.conf:
LoadModule python_module modules/mod_python.so

but my script folder configuration doesn't work correctely:

Alias /myfolder D:/myfolder

<Directory "/myfolder">
Order allow,deny
Allow from all
AddHandler mod_python .py
PythonHandler mod_python.publisher
PythonDebug On
</Directory>

for test, this is a sample script d:\myfolder\test.py
# test.py
#
from mod_python import apache
#
def hello(name=None):
if name:
return 'Hello, %s!' % name.capitalize()
else:
return 'Hello there!'
#
def handler(req):
req.content_type = 'text/plain'
req.write("from handler test, Hello World!")
return apache.OK

when I access to the url http://localhost/myfolder/test.py,
I obtain source test.py listing but not the rendering of handler or
hello method.

with url http://localhost/myfolder/test.py/hello, I obtain :
=>The requested URL /myfolder/test.py/hello was not found on this server.

It seems like something is missing ... but what ?

thanks for any help
 
Reply With Quote
 
 
 
 
Graham Dumpleton
Guest
Posts: n/a
 
      12-19-2006

m.banaouas wrote:
> sorry, I give here the right paths:
>
> I installed Apache 2.2.3 and mod_python 3.2.10 on WinXP plateform
> I configured mod_python via httpd.conf:
> LoadModule python_module modules/mod_python.so
>
> but my script folder configuration doesn't work correctely:
>
> Alias /myfolder D:/myfolder
>
> <Directory "/myfolder">
> Order allow,deny
> Allow from all
> AddHandler mod_python .py
> PythonHandler mod_python.publisher
> PythonDebug On
> </Directory>
>
> for test, this is a sample script d:\myfolder\test.py
> # test.py
> #
> from mod_python import apache
> #
> def hello(name=None):
> if name:
> return 'Hello, %s!' % name.capitalize()
> else:
> return 'Hello there!'
> #
> def handler(req):
> req.content_type = 'text/plain'
> req.write("from handler test, Hello World!")
> return apache.OK
>
> when I access to the url http://localhost/myfolder/test.py,
> I obtain source test.py listing but not the rendering of handler or
> hello method.
>
> with url http://localhost/myfolder/test.py/hello, I obtain :
> =>The requested URL /myfolder/test.py/hello was not found on this server.
>
> It seems like something is missing ... but what ?
>
> thanks for any help


Get it working for a normal handler first and don't use
mod_python.publisher.

For a set of instructions on how to get a simple handler working,
including descriptions of common problems and how to debug it, see:


http://www.dscpl.com.au/wiki/ModPyth...dPythonWorking

Once you have confirmed that your installation works, then consider
looking at mod_python.publisher.

I'd also suggest that you get yourself on the mod_python user mailing
list and seek help there as the mod_python community there is much
larger. Mailing list details are on the mod_python web site.

BTW, don't you mean:

<Directory "D:/myfolder">

if that is what Alias uses?

Also, don't mix normal handlers and mod_python.publisher functions in
the same module, and don't use files called 'test.py' as there is a
standard Python module by the same name and if things aren't set up
right you can be picking up the wrong module.

Graham

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with mod_python/3.3.1 and apache NccWarp9 Python 1 03-31-2008 10:13 PM
mod_python.so is garbled mod_python.so is garbled blbmdsmith Python 1 12-14-2006 12:15 AM
Help required with mod_python and apache virtual hosts andy Python 3 10-02-2004 12:02 AM
Problems with setting up mod_python and Apache John Dean Python 6 09-11-2003 07:02 PM
Apache mod_python and Sessions Markus Schaber Python 7 07-08-2003 05:55 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57