Getting mod_python to Work

Discussion in 'Python' started by jpuopolo, Aug 5, 2008.

  1. jpuopolo

    jpuopolo Guest

    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.publisher, 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.publisher?

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

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

    Many thanks,
    jpuopolo
     
    jpuopolo, Aug 5, 2008
    #1
    1. Advertising

  2. jpuopolo

    jpuopolo Guest

    On Aug 5, 8:44 am, jpuopolo <> wrote:
    > 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.publisher, 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.publisher?
    >
    > Here is the relevant section from my httpd.conf file:
    >
    > LoadModule python_module modules/mod_python.so
    > <Directory "C:\Program Files\Apache Software Foundation\Apache2.2\cgi-
    > bin/">
    >   AddHandler mod_python .py
    >   #PythonHandler mptest --- works if I uncomment this line and comment
    > next line
    >   PythonHandler mod_python.publisher
    >   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/07/31/my-mod_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\Apache2.2\cgi-
    bin/">
    AddHandler mod_python .py
    PythonHandler mod_python.publisher
    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
     
    jpuopolo, Aug 5, 2008
    #2
    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. Mike Medland

    Mod_python xml parsing problem

    Mike Medland, Jul 1, 2003, in forum: Python
    Replies:
    0
    Views:
    392
    Mike Medland
    Jul 1, 2003
  2. Markus Schaber

    Apache mod_python and Sessions

    Markus Schaber, Jul 4, 2003, in forum: Python
    Replies:
    7
    Views:
    864
    Irmen de Jong
    Jul 8, 2003
  3. Nancy
    Replies:
    1
    Views:
    563
    Doug Holton
    Jul 18, 2004
  4. Daniele Varrazzo
    Replies:
    1
    Views:
    295
    Doug Holton
    Jul 19, 2004
  5. blbmdsmith
    Replies:
    1
    Views:
    661
    Graham Dumpleton
    Dec 14, 2006
Loading...

Share This Page