I could install apache &lifier python effectively from source.

I installed mod_python with following configure command:

./configure --prefix=/usr/local/python/lib/python2.5/site-packages/mod_python --with-apxs=/usr/local/apache/bin/apxs --with-python=/usr/local/python/bin/python2.5

I replicated my test file (mptest.py) to htdocs/test folder, following is my mptest:

from mod_python import apache

def handler(req):
      req.content_type = 'text/plain'
      return apache.OK

also i replicated my .htaccess to htdocs/test folder, following is my .htaccess:

AddHandler mod_python .py

PythonHandler mptest

PythonDebug On

I get the mistake, Internet Server Error and following is my apache error log :

[Wed Nov 16 17:10:48 2011] [notice] mod_python: Creating 8 session mutexes based on 256 >max processes and 0 max threads.

[Wed Nov 16 17:10:48 2011] [notice] mod_python: using mutex_directory /tmp 

[Wed Nov 16 17:10:48 2011] [notice] Apache/2.2.21 (Unix) PHP/5.2.17 mod_python/3.3.2-dev-20080819 Python/2.5.4 configured -- resuming normal operations

[Wed Nov 16 17:11:00 2011] [error] make_obcallback: could not import mod_python.apache.\n
ImportError: No module named mod_python.apache

[Wed Nov 16 17:11:00 2011] [error] make_obcallback: Python path being used "['/Library/Python/2.5/site-packages/setuptools-0.6c11-py2.5.egg', '/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python25.zip', '/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5', '/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python', '/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-dynload', '/Library/Python/2.5/site-packages', '/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/PyObjC', '/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/wx-2.8-mac-unicode']".

[Wed Nov 16 17:11:00 2011] [error] get_interpreter: no interpreter callback found.

[Wed Nov 16 17:11:00 2011] [error] [client ::1] python_handler: Can't get/create interpreter., referer: http://localhost/test/

my mod_python.same with associated with system's python that we dont want, proof is below. how do i link it to python installed by me?

Mac-Pro:~ user$ otool -L /usr/local/apache/modules/mod_python.so 

    /System/Library/Frameworks/Python.framework/Versions/2.5/Python (compatibility version 2.5.0, current version 2.5.4)

/usr/lib/libSystem.B.dylib (compatibility version 1.., current version 125..) /usr/lib/libgcc_s.1.dylib (compatibility version 1.., current version 625..)

Among the finest to show mptest.py during my internet browser, can anyone assist me to ?

I understand mod_wsgi is much better option than mod_python, but I have to make mod_python work. I'll try mod_wsgi later.


I am afraid I can not assist with mod_python. We have switched all of our code from mod_python in support of mod_wsgi rather than looked back.

mod_wsgi has some good features -- as well as a chance to easily create debug/diagnostic code than could be run entirely from python with no trouble of running Apache (which opens a chance to run debuggers &lifier print straight to stdout).

Should you go lower the road of wsgi, think about using webob for controlling Request/Response objects.

Here's how you'd code your example in mod_wsgi

# --------- EXAMPLE ----------

from webob import Response

def application(environ, start_response):
    res = Response()
    res.content_type = 'text/plain'
    res.body = "mptest.py\r\n"
    return res(environ, start_response)

Best of luck.