Successful installation of mod_python on Apache on Win2k?

Discussion in 'Python' started by Rolfe, Sep 26, 2003.

  1. Rolfe

    Rolfe Guest

    Has anyone had success getting mod_python to run on Apache on Win2K?
    I'm writing up instructions on how to do this and need your help. When
    completed, the instructions at the mod_python website and on
    comp.lang.python crediting all those who contributed.
    <p>
    Here's what I've done so far - and where I get stuck:
    <p>
    1. I made default installations of the latest versions:
    - apache_2.0.47-win32-x86-no_ssl.msi
    - mod_python-3.0.3.win32.exe
    <p>
    2. I followed the installation/configuration instructions provided at
    the end of the mod_python-3.0.3.win32.exe installation.
    <p>
    3. When I created and ran the following script shown at
    http://www.modpython.org/live/current/doc-html/inst-testing.html, my
    browser displays the full text of the script instead of running the
    script:
    "from mod_python import apache

    def handler(req):
    req.write("Hello World!")
    return apache.OK"

    4. I've read Troubleshooting and FAQ, triple-checked my http.conf
    file, and still can't get it to work.

    ANY SUGGESTIONS?

    Thanks,

    Rolfe
    Rolfe, Sep 26, 2003
    #1
    1. Advertising

  2. Rolfe

    Peter Maas Guest

    Rolfe wrote:
    > 3. When I created and ran the following script shown at
    > http://www.modpython.org/live/current/doc-html/inst-testing.html, my
    > browser displays the full text of the script instead of running the
    > script:
    > "from mod_python import apache
    >
    > def handler(req):
    > req.write("Hello World!")
    > return apache.OK"
    >
    > 4. I've read Troubleshooting and FAQ, triple-checked my http.conf
    > file, and still can't get it to work.
    >
    > ANY SUGGESTIONS?


    This is my working conf (on Linux, though):

    LoadModule python_module modules/mod_python.so

    <Directory /usr/local/apache2/htdocs/test>
    AddHandler python-program .py
    PythonHandler mptest
    PythonDebug On
    </Directory>

    /usr/local/apache2/htdocs/test/mptest.py works. If you have an
    analogous conf, it might be an OS related issue.

    Mit freundlichen Gruessen,

    Peter Maas

    --
    -------------------------------------------------------------------
    Peter Maas, M+R Infosysteme, D-52070 Aachen, Hubert-Wienen-Str. 24
    Tel +49-241-93878-0 Fax +49-241-93878-20 eMail
    -------------------------------------------------------------------
    Peter Maas, Sep 26, 2003
    #2
    1. Advertising

  3. Rolfe

    Rolfe Guest

    > From: Rolfe Dlugy-Hegwer [mailto:RDlugyHegwer at symmetricom dot com]
    > Sent: Thursday, September 25, 2003 7:53 PM
    > To: 'sholden at holdenweb dot com'
    > Subject: mod_python on Win2k question
    >
    >
    > Hi Steve,
    >
    > I saw your thread on comp.lang.python: "I'm interested in installing
    > mod_python in two environments:1. Wind2000/Apache2"
    >
    > Any joy getting mod_python to run on Win2k?
    >

    Oh, yes. To quote Stanley Unwin (of whom you've probably never heard)
    "Deep joy in the fundimole".

    > I 1)downloaded fresh versions of apache and mod python, 2)made default
    > installations, 3)followed additional configuration
    > instructions for mod
    > python, 4) followed the tests recommended by mod_python
    > documentation, 5)


    OK, well I [...] just downloaded the installer. I
    had Python 2.2 installed, and I decided not to push the envelope by
    recompiling for 2.3 (which I also had installed). I also chose the
    somewhat older 3.0 mod_python, and then bolted the session and cookie
    stuff on from the 3.1 alpha mod_python, which seems to work after a bit
    of grotesque hacking an d one bug removal.

    > consulted the mod_python FAQ
    > and I can't get it to work. My browser displays the .py file
    > as text instead
    > of running it as a script.
    >

    It's probably the directory characteristics that need to change. If you
    plan to use the publisher interface (probably about the most general
    thing to do), you need to bear two things in mind:

    1. Mod_python doesn't play well in script-aliased directories, so don't
    try using your cgi-bin directory for mod_python scripts.

    2. You'll need an .htaccess file that reads something like [ferkles in
    /Inetpub/wwwroot/modpython ...] this:

    DirectoryIndex index.py
    AddHandler python-program .py
    PythonHandler mod_python.publisher
    PythonDebug On

    Actually you don't need the DirectoryIndex line, and obviously you can
    set up equivalent <Directory> lines in httpd.conf instread if you want.

    > I'm going find someone who has succeeded and will write up
    > instructions for
    > the mod_python FAQ and for comp.lang.python.
    >

    I'm sure that would be very useful. Let me know if this has helped! [...] ;-)

    regards
    --
    Steve Holden http://www.holdenweb.com/
    Python Web Programming http://pydish.holdenweb.com/pwp/
    Interview with GvR August 14, 2003 http://www.onlamp.com/python/
    Rolfe, Sep 26, 2003
    #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. walala
    Replies:
    4
    Views:
    2,073
    Ralf Hildebrandt
    Sep 8, 2003
  2. Rolfe
    Replies:
    2
    Views:
    363
    Rolfe
    Sep 29, 2003
  3. Piet
    Replies:
    6
    Views:
    1,190
    David Fraser
    Sep 2, 2004
  4. Andrea Fiore

    Mod_python installation: apache Warning

    Andrea Fiore, Mar 16, 2005, in forum: Python
    Replies:
    0
    Views:
    347
    Andrea Fiore
    Mar 16, 2005
  5. blbmdsmith
    Replies:
    1
    Views:
    629
    Graham Dumpleton
    Dec 14, 2006
Loading...

Share This Page