[mod_python] Problems with mod_python on OSX

Lee E. Brown Administrator at leebrown.org
Tue Sep 7 17:36:49 EDT 2004


Greetings!

If  "/Users/jacob/Sites/PyTest" is not an absolute physical path, Python
will have all sorts of troubles.  For some reason, virtual paths and path
aliases will not work.

For example, you would think that

   Alias /fred/ "C:/webstuff/websites/mysite/fred/"
   ...

and then

   <Directory "/fred/">
          AddHandler mod_python .py
          PythonHandler test
         ...

would work, but it doesn't.  But

   <Directory "C:/webstuff/websites/mysite/fred/">
          AddHandler mod_python .py
          PythonHandler test
         ...

works just fine.  I suspect that this is because the handler intercepts the
request before Apache has had a chance to resolve aliases or virtual paths.
(I think so, anyway.  I'm somewhat of a newbie myself.)


Best Regards,
Lee E. Brown
----- Original Message ----- 
From: "Jacob Kaplan-Moss" <jacob at jacobian.org>
To: <mod_python at modpython.org>
Sent: Tuesday, September 07, 2004 2:27 PM
Subject: [mod_python] Problems with mod_python on OSX


> Hey all --
> 
> I'm trying to get mod_python working on my PowerBook, and I'm running 
> into a problem that's leaving me stumped.  I installed Apache2 from 
> source, and built mod_python by doing:
> 
> - ./configure --prefix=/usr/local/apache2 
> --with-apxs=/usr/local/apache2/bin/apxs
> - Edit src/Makefile; add "OPT=-DEAPI" (line 28)
> - make && make install
> 
> I'm using the stock Python (2.3), and this seems to work; 
> /usr/local/apache2/bin/apachectl start works, and I see:
> 
> [Tue Sep 07 13:15:21 2004] [notice] Apache/2.0.50 (Unix) 
> mod_python/3.1.3
> Python/2.3 configured -- resuming normal operations
> 
> in my Apache error log.
> 
> However, any time I try to use mod_python, I get an internal service 
> error, and the error log contains only this cryptic line:
> 
> [Tue Sep 07 13:15:37 2004] [warn] Cannot get media type from 
> 'cgi-script'
> 
> Right now, I'm doing the bare basics; here's the relevant section of my 
> httpd.conf:
> 
>      <Directory "/Users/jacob/Sites/PyTest">
>          AddHandler mod_python .py
>          PythonHandler test
>          PythonDebug On
>      </Directory>
> 
> and test.py contains:
> 
> from mod_python import apache
> 
> def handler(req):
> req.content_type = "text/plain"
> req.wite("It worked")
> return apache.OK
> 
> Does anyone have any idea what's going on?
> 
> Thanks a bunch,
> 
> Jacob
> 
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python


More information about the Mod_python mailing list