Newbie Question

Discussion in 'Python' started by Jeremy Bowers, Feb 2, 2005.

  1. On Tue, 01 Feb 2005 17:47:39 -0800, Joel Eusebio wrote:
    > Whenever I access test.py from my browser it says "The page cannot be
    > found" , I have the file on /var/www/html, what did I miss?
    >
    > Thanks in advance,
    > Joel


    In general, you will need to post the relevant entries from your Apache
    error log and access log. A lot of things can go wrong between your Python
    script and final output.

    However, if you're getting a 404, it means that you haven't associated the
    URL to the file correctly. Again, a lot of things can prevent this, so
    you're also going to need to post the relevant Apache configuration files.
    Without that, I can't be any more specific.

    I'm also concerned that you are conflating mod_python with Python CGI,
    which work completely differently when it comes to associating code to
    URLs. In general, you won't access a mod_python script by typing in a
    URL to a file; that will either try to run it as a CGI or just display it
    (depending on the configuration). But we'll work on this when you post the
    necessary information and we can see what you are trying to do.
    Jeremy Bowers, Feb 2, 2005
    #1
    1. Advertising

  2. Jeremy Bowers

    Joel Eusebio Guest

    Hi Everybody,

    I'm pretty new to Python and would like to ask a few questions. I have this
    setup on a Fedora Core 3 box.

    Python 2.3.4
    wxPython-common-gtk-ansi-2.5.3.1-fc2_py2.3
    mod_python-3.1.3-5
    Apache/2.0.52

    I have a test.py which looks like this:
    from mod_python import apache
    def handler(req):
    req.write("Hello World!")
    return apache.OK

    Whenever I access test.py from my browser it says "The page cannot be found"
    , I have the file on /var/www/html, what did I miss?

    Thanks in advance,
    Joel
    Joel Eusebio, Feb 2, 2005
    #2
    1. Advertising

  3. On Tue, 01 Feb 2005 17:47:39 -0800, Joel Eusebio wrote:

    >
    > Hi Everybody,
    >
    > I'm pretty new to Python and would like to ask a few questions. I have this
    > setup on a Fedora Core 3 box.
    >
    > Python 2.3.4
    > wxPython-common-gtk-ansi-2.5.3.1-fc2_py2.3
    > mod_python-3.1.3-5
    > Apache/2.0.52
    >
    > I have a test.py which looks like this:
    > from mod_python import apache
    > def handler(req):
    > req.write("Hello World!")
    > return apache.OK
    >


    This code looks like you are attempting to define a handler. In this case
    the handler needs to be properly set up in either your httpd.conf or a
    ..htaccess (assuming your configuration allows for that).

    > Whenever I access test.py from my browser it says "The page cannot be found"
    > , I have the file on /var/www/html, what did I miss?


    You don't access handlers like you do CGI. This problem likely lies in
    your configuration and not in your code. I would look at mod_python's
    documentation some more and probably start with mod_python's
    PublisherHandler for initial testing and experimentation.

    -Robey Holderith

    > Thanks in advance,
    > Joel
    Robey Holderith, Feb 2, 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. Jerry C.
    Replies:
    8
    Views:
    210
    Uri Guttman
    Nov 23, 2003
  2. Kruno Saho
    Replies:
    0
    Views:
    126
    Kruno Saho
    Apr 7, 2013
  3. Dave Angel
    Replies:
    0
    Views:
    111
    Dave Angel
    Apr 7, 2013
  4. rusi
    Replies:
    0
    Views:
    101
  5. Miki Tebeka
    Replies:
    0
    Views:
    75
    Miki Tebeka
    Apr 7, 2013
Loading...

Share This Page