Getting mod_python to Work

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jpuopolo

    Getting mod_python to Work

    Hi, all...

    I am hoping that someone can help me with the magic incantation to get
    mod_python working on my local machine.

    Set up: Apache 2.2.9, mod_python 3.3.1 on Windows Vista (yes, pity
    me).

    I've gotten the basic mptest.py handler to work with no problem. I am
    now trying to use the mod_python.publ isher, but when I do, I get a 404
    Not Found error for any file I try to access. If I switch back to my
    simple mptest,py handler, everything works fine.

    What do I need to do so that I can use the mod_python.publ isher?

    Here is the relevant section from my httpd.conf file:

    LoadModule python_module modules/mod_python.so
    <Directory "C:\Program Files\Apache Software Foundation\Apac he2.2\cgi-
    bin/">
    AddHandler mod_python .py
    #PythonHandler mptest --- works if I uncomment this line and comment
    next line
    PythonHandler mod_python.publ isher
    PythonDebug On
    </Directory>

    Many thanks,
    jpuopolo

  • jpuopolo

    #2
    Re: Getting mod_python to Work

    On Aug 5, 8:44 am, jpuopolo <puop...@gmail. comwrote:
    Hi, all...
    >
    I am hoping that someone can help me with the magic incantation to get
    mod_python working on my local machine.
    >
    Set up: Apache 2.2.9, mod_python 3.3.1 on Windows Vista (yes, pity
    me).
    >
    I've gotten the basic mptest.py handler to work with no problem. I am
    now trying to use the mod_python.publ isher, but when I do, I get a 404
    Not Found error for any file I try to access. If I switch back to my
    simple mptest,py handler, everything works fine.
    >
    What do I need to do so that I can use the mod_python.publ isher?
    >
    Here is the relevant section from my httpd.conf file:
    >
    LoadModule python_module modules/mod_python.so
    <Directory "C:\Program Files\Apache Software Foundation\Apac he2.2\cgi-
    bin/">
      AddHandler mod_python .py
      #PythonHandler mptest --- works if I uncomment this line and comment
    next line
      PythonHandler mod_python.publ isher
      PythonDebug On
    </Directory>
    >
    Many thanks,jpuopolo
    All:

    As it turns out, it was the URL I was using that made the difference -
    and the URL that worked was http://localhost/cgi-bin/helloworld.py/handler

    Note the /handler at the end of the URL --- this made all the
    difference.

    I found the answer here: http://mohitsuley.wordpress.com/2008...od_python-101/

    So, in summary, to have mod_python work:

    1. Add the following to your httpd.conf file:

    #Start of section pasted in by YOURNAME
    LoadModule python_module modules/mod_python.so
    <Directory "C:\Program Files\Apache Software Foundation\Apac he2.2\cgi-
    bin/">
    AddHandler mod_python .py
    PythonHandler mod_python.publ isher
    PythonDebug On
    </Directory>
    #End of section pasted in by YOURNAME

    I put this at the end of the other LoadModule entries in the
    httpd.conf file.

    2. Save your httpd.conf file.
    3. Restart Apache (either close/restart or restart the Windows
    service, depending on your configuration).
    4. Ensure the URL to your .py files in your cgi-bin directory (or
    whatever directory you've configured, see above) end in /handler

    I hope this helps someone...

    Thank you,
    jpuopolo

    Comment

    Working...