[mod_python] Anyone get Darwin ports working on macosx (tiger)

Graham Dumpleton grahamd at dscpl.com.au
Mon Jul 17 18:05:08 EDT 2006


Steven Hum wrote ..
> Hi,
> 
> Installed Darwin ports for apache 2.2.e and mod_python 3.2.8 and get  
> this in the error_log:

Apache 2.2 does not work with mod_python 3.2.8, you must use Apache 2.0.X.

> In the apache2/htdocs/.htaccess have:
> 
>      AddHandler mod_python .py
>      PythonHandler mptest.py

Should be:

  PythonHandler mptest

>      PythonDebug On
> 
> In apache2/htdocs/mptest.py have:
> 
> from mod_python import apache
> def handler(req):
> 	req.send_http_header()
> 	req.content_type = 'text/plain'

The req.send_http_header() call is redundant on mod_python 3.X. Even when
being used with mod_python 2.X, the content type must have been set before
the call to req.send_http_header(). See:

  http://www.dscpl.com.au/articles/modpython-001.html

for a correct mptest example.

> 	req.write("Hello World!")
> 	return apache.OK
> 
> When I try http://localhost/mptest.py, I simply get the above python  
> script listed in the browser and get in the error_log:
> 
> [Mon Jul 17 17:25:43 2006] [error] [client ::1] File does not exist: /
> opt/local/apache2/htdocs/favicon.ico
> [Mon Jul 17 17:25:44 2006] [crit] (70023)This function has not been  
> implemented on this platform: DBD: driver for  not available
> [Mon Jul 17 17:25:44 2006] [crit] (70023)This function has not been  
> implemented on this platform: DBD: failed to initialise
> [Mon Jul 17 17:25:51 2006] [error] [client ::1] File does not exist: /
> opt/local/apache2/htdocs/favicon.ico
> 
> Not sure why the above url referenced the favicon.ico file. I put a  
> favicon in the htdocs directory and when the url is reloaded, don't  
> get any error messages but still only get the python source listed in 
> the browser.

The favicon.ico is requested by some web browsers. It is the small icon
the browser sticks to the left of the URL in the URL bar.

Graham


More information about the Mod_python mailing list