473,383 Members | 1,922 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Apache 2.2.3 and mod_python 3.2.10

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
Dec 19 '06 #1
2 3177
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
Dec 19 '06 #2

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

Dec 19 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Rolfe | last post by:
Hi, I struggled, and got mod_python running on Apache/Win2k. Follow these instructions verbatim and you shouldn't have any trouble. These instructions are based on...
6
by: Piet | last post by:
Hi there, I cannot install mod_python v3.1.3 on either Win2k/ActivePython 2.3.2 or WinMe/Python 2.3.4. When I run the Windows installer, I get the following error message: Traceback (most recent...
2
by: digidalmation | last post by:
Hello all. I've been trying to get my linux server to run mod_python. It's a Mandrake 10 linux box, and apache/mod_python are installed from rpms. apache2-mod_python-2.0.48_3.1.3-1mdk...
0
by: Christopher | last post by:
I am running: Fedora Core 1 Python 2.4 Apache 1.3.3 mod_python 2.7.11 When I try to access the test mptest.py file I receive: > Internal Server Error
1
by: neha | last post by:
hi, i m trying to integrate python with apache on linux.For this i m using mod_python. I dont see any problem with the versions of python,apache and mod_python i m using. the versions i m using...
9
by: cyberco | last post by:
And I thought this would be trivial...getting mod_python to run within apache on windows XP. ============= mod_python 3.2.8 apache 2.0.55 python2.4 winxp =============
5
by: m.banaouas | last post by:
Hi, bonjour, witch versions are suitable to use for apache & mod_python ? Can i install and use "Apache 2.2.3" & "mod_python 3.2.10" (most recent versions) without facing any known major...
3
by: joe jacob | last post by:
I configured apache to execute python scripts using mod_python handler. I followed below mentioned steps to configure apache. 1. In http.conf I added <Directory...
1
by: NccWarp9 | last post by:
Hello, im using Apache HTTPD 2.2.8 with mod_python/3.3.1 Python/2.4.3 on Windows and having truble starting pythone, any help would be appreciated .. Im getting this error: ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.