473,320 Members | 1,982 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,320 software developers and data experts.

mod_python: what's going on here?

I'm not entirely certain comp.lang.python is the proper newsgroup for
mod_python questions, but "comp.lang.python.web" doesn't seem to exist,
so... my apologies in advance if this is considered off-topic.

I'm attempting to get mod_python 3.1.4/python 2.4.1 working on Apache
2.0.54 running under OS X. Apache was compiled from source with a
simple

/configure --enable-so --with-mpm=worker

.... followed by the make/make install dance. mod_python was almost as
simple:

../configure --with-apxs=/usr/local/apache2/bin/apxs \
--with-python=/sw/bin/python2.4

.... followed by the requisite dance.

At this point, all's well. The following bits were added to
httpd.conf:

LoadModule python_module /usr/local/apache2/modules/mod_python.so
<Directory "/usr/local/apache2/htdocs/test">
AddHandler mod_python .py
PythonHandler mptest
PythonDebug on
</Directory>

.... one apachectl restart later, Apache was running fine and serving
pages. The version string at the bottom of some static pages listed
mod_python as being present, so I reckoned that meant it was all
installed all right. However, any attempt to serve a mod_python
script, mptest.py, from the test subdirectory results in a 500 Internal
Server Error. Nothing gets written to error_log, but access_log
confirms the 500 was sent.

Does anyone have any experience with mod_python on OS X/Apache
environments? Can anyone shed some light on 500s that don't leave
traces in the error logs, or what precise incantation I need to make
mod_python start serving up scripts?

Also, if this is not appropriate for this group, does anyone know of a
Python group for which this is more appropriate?

Sep 5 '05 #1
2 2055
Robert J. Hansen wrote:
I'm not entirely certain comp.lang.python is the proper newsgroup for
mod_python questions, but "comp.lang.python.web" doesn't seem to exist,
so... my apologies in advance if this is considered off-topic.

I'm attempting to get mod_python 3.1.4/python 2.4.1 working on Apache
2.0.54 running under OS X. Apache was compiled from source with a
simple

/configure --enable-so --with-mpm=worker

... followed by the make/make install dance. mod_python was almost as
simple:

./configure --with-apxs=/usr/local/apache2/bin/apxs \
--with-python=/sw/bin/python2.4

... followed by the requisite dance.

At this point, all's well. The following bits were added to
httpd.conf:

LoadModule python_module /usr/local/apache2/modules/mod_python.so
<Directory "/usr/local/apache2/htdocs/test">
AddHandler mod_python .py
PythonHandler mptest
PythonDebug on
</Directory>

... one apachectl restart later, Apache was running fine and serving
pages. The version string at the bottom of some static pages listed
mod_python as being present, so I reckoned that meant it was all
installed all right. However, any attempt to serve a mod_python
script, mptest.py, from the test subdirectory results in a 500 Internal
Server Error. Nothing gets written to error_log, but access_log
confirms the 500 was sent.

Does anyone have any experience with mod_python on OS X/Apache
environments? Can anyone shed some light on 500s that don't leave
traces in the error logs, or what precise incantation I need to make
mod_python start serving up scripts?

Also, if this is not appropriate for this group, does anyone know of a
Python group for which this is more appropriate?

You will probably get help on this newsgroup, but the mod-python list is
pretty helpful, and there's a Python Web-Sig mailing list you can find
out about at http://www.python.org/sigs/ if you want.

I'm afraid I am new to OS X (and 3,000 miles away from my Mac Mini), so
I can't be any help directly with any Mac-dependent issues. But when I
first started using mod_python someone (I'm afraid I don't remember who)
advised me to use SetHandler rather than AddHandler.

Looking at my Windows httpd.conf (2.0.52, so close enough to yours) I see

################################################## #######################
# #
# MOD_PYTHON TESTING AREA #
# #
################################################## #######################
#
# Request handler
#
<Directory "C:/apache/htdocs/modpy">
AllowOverride FileInfo
SetHandler mod_python
PythonHandler mptest
PythonDebug On
</Directory>
#
# Filter handler
#
<Directory "C:/Apache/htdocs/test">
AllowOverride All
SetHandler mod_python
#PythonHandler mptest1
#PythonFixupHandler mptest1
PythonLogHandler mptest1
PythonOutputFilter mptest1 CAPITALIZE
AddOutputFilter CAPITALIZE .txt .py
PythonDebug On
</Directory>

This might at least be enough to start generating sensible error messages.

One further possibility is that Apache is using an older Python by
default: byte codes vary from version to version, so something horrible
might be happening as mod_python tries to execute, but that seems a bit
far-fetched when you've got so far. I seem to remember that OS X doesn't
supply 2.4 by default: have you added it or overwritten the default
Python? Just another base to cover ...

regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/

Sep 5 '05 #2
Robert J. Hansen a écrit :
Does anyone have any experience with mod_python on OS X/Apache
environments? Can anyone shed some light on 500s that don't leave
traces in the error logs, or what precise incantation I need to make
mod_python start serving up scripts?
Here is a setup that works for me on 10.3, with Apache2 2.54, python
2.4.1 and mod_python 3.1.4, all installed from source. This should
probably work also with your python from fink.

Apache2:
../configure --enable-mods-shared=all --enable-so

Python:
../configure

mod_python:
../configure --enable-so

Also, if this is not appropriate for this group, does anyone know of a
Python group for which this is more appropriate?

The mod_python mailing list ? At http://www.modpython.org/ .

Regards,

Olivier

Sep 5 '05 #3

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

Similar topics

7
by: Nancy | last post by:
Hi, Is there any one knows, if I want to use mod_python to handle my html form, I must have a SMTP server on my PC(winxp pro)? Where can I get a free SMTP server? I cann't follow mod_python's...
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: Python_it | last post by:
I'm going to work with mod_python. I install mod_python 3.2.2b for python 2.4. If i test my install with mptest.py see this link:...
6
by: Anthony L. | last post by:
I am writing a web application that is comparable to a content management system used in blogging. I really want to use Python after having done some evaluation coding using Python 2.3.5 with...
1
by: treelife | last post by:
I'm getting and internal server error when | run the following mod_python script. I am actually trying to run Django. Script: from mod_python import apache def handler(req):...
10
by: walterbyrd | last post by:
I am considering python, instead of php, for web-application development. I often see mod_python.criticisized as being borked, broken, or just plain sucking. Any truth to any of that?
10
by: Vincent Delporte | last post by:
Hi I'm still a newbie when it comes to web applications, so would like some help in choosing a solution to write apps with Python: What's the difference between using running it through...
3
by: Michael | last post by:
Hey everyone, Is it possible to automatically insert headers/footers using mod_python? I will be not be using PSP's, so I cannot use the PSP/include solution. Furthermore, the header will be...
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...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.