mod_python: what's going on here?

Discussion in 'Python' started by Robert J. Hansen, Sep 5, 2005.

  1. 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?
     
    Robert J. Hansen, Sep 5, 2005
    #1
    1. Advertising

  2. Robert J. Hansen

    Steve Holden Guest

    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/
     
    Steve Holden, Sep 5, 2005
    #2
    1. Advertising

  3. Robert J. Hansen

    Olivier Guest

    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
     
    Olivier, Sep 5, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kathy Burke
    Replies:
    6
    Views:
    638
    Munsifali Rashid
    Aug 13, 2003
  2. What Is Going On Here?

    , Jul 13, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    1,375
    Craig Deelsnyder
    Jul 15, 2005
  3. subnet

    What's going on here?

    subnet, May 4, 2004, in forum: C Programming
    Replies:
    3
    Views:
    367
    CBFalconer
    May 5, 2004
  4. John Salerno

    what's going on here?

    John Salerno, Mar 16, 2006, in forum: Python
    Replies:
    3
    Views:
    242
    =?ISO-8859-1?Q?Sch=FCle_Daniel?=
    Mar 16, 2006
  5. blbmdsmith
    Replies:
    1
    Views:
    660
    Graham Dumpleton
    Dec 14, 2006
Loading...

Share This Page