problem running a python script using apache,mod_python on linux

Discussion in 'Python' started by neha, Oct 19, 2005.

  1. neha

    neha Guest

    hi,
    i m trying to integrate python with apache on linux.For this i m using
    mod_python.
    I dont see any problem with the versions of python,apache and
    mod_python i m using.
    the versions i m using are
    apache version2.
    mod_python v3.1.14
    python2.4
    The problem is,when i m running my python script,after starting apache
    ,it is showing me the code it has.

    My error_log is showing the following message


    [Tue Oct 18 19:01:06 2005] [notice] Apache/2.0.55 (Unix)
    mod_python/3.1.4 Python/2.4.2 configured -- resuming normal operations
    [Tue Oct 18 19:01:06 2005] [info] Server built: Oct 17 2005 13:07:52
    [Tue Oct 18 19:01:06 2005] [debug] prefork.c(956): AcceptMutex: sysvsem
    (default: sysvsem)


    the access_log is showing this message:
    127.0.0.1 - - [18/Oct/2005:19:01:14 +0530] "GET /apache_pb.gif
    HTTP/1.1" 200 2326
    127.0.0.1 - - [18/Oct/2005:19:01:19 +0530] "GET /test/mptest.py
    HTTP/1.1" 200 110


    from the python script,i m returning an apache.OK ,so i think it goin
    on fine,as i m getting 200i.e the hhtp processing is goin on fine.


    I have made the required changes to the httpd.conf file
    ***
    LoadModule python_module /home/ngupta/Apache2/modules/mod_python.so


    DocumentRoot "/home/ngupta/Apache2/htdocs"

    <Directory />
    AllowOverride FileInfo
    </Directory>

    ***
    I m using a .htaccess file placed under Apache2/htdocs/test/
    The .htaccess file has the following code
    **
    AddHandler mod_python .py
    PythonHandler mptest
    PythonDebug On
    **
    where mptest is python script and is as follows
    **
    from mod_python import apache
    def handler(req):
    req.send_http_header()
    req.write("Hello")
    return apache.OK
    **
    so if anyone knows where the problem lies ,please tell me.
    thanks.
    Neha gupta
     
    neha, Oct 19, 2005
    #1
    1. Advertising

  2. neha

    Brad Teale Guest

    Neha,

    > I have made the required changes to the httpd.conf file
    > ***
    > LoadModule python_module /home/ngupta/Apache2/modules/mod_python.so


    Did you also add the line:
    AddModule mod_python.c

    > DocumentRoot "/home/ngupta/Apache2/htdocs"
    >
    > <Directory />
    > AllowOverride FileInfo
    > </Directory>
    >
    > ***
    > I m using a .htaccess file placed under Apache2/htdocs/test/
    > The .htaccess file has the following code
    > **
    > AddHandler mod_python .py
    > PythonHandler mptest
    > PythonDebug On
    > **


    I didn't see anything else that jumps out.

    Brad
     
    Brad Teale, Oct 19, 2005
    #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. Bowen Chiu
    Replies:
    1
    Views:
    553
    Skip Montanaro
    Aug 9, 2003
  2. Rolfe
    Replies:
    1
    Views:
    310
    M-a-S
    Oct 3, 2003
  3. blbmdsmith
    Replies:
    1
    Views:
    662
    Graham Dumpleton
    Dec 14, 2006
  4. Pablo
    Replies:
    0
    Views:
    976
    Pablo
    Mar 28, 2007
  5. joe jacob
    Replies:
    3
    Views:
    711
    joe jacob
    Aug 14, 2007
Loading...

Share This Page