[mod_python] PLEASE guide

nitin chandra nitinchandra1 at gmail.com
Mon Dec 10 04:32:02 EST 2007


Hello Everyone,


I wrote this script below, it is installed in '/var/www/html/lr' directory.
Installed are Apache 2, mod_python2.2, and postgreSQL8.2 and python 2.4


=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X

from mod_python import apache
import psycopg2

template = """<html>
<head><title>Candidates' Details Entered</title></head>
<body bgcolor="#87CEFA">
<H1 ALIGN="CENTER"/><U/>Candidates' Details Entered</U/></H1/>
<table align=left border=2 cellpadding=6>
%s
</table>
</body>
</head>"""

def query(req, query, rows=[]):
    conn = psycopg2.connect('user=nitin dbname=nitin')
    curs = conn.cursor()
    curs.execute( 'SELECT * FROM area' ) ## Running this line from
command prompt, it works.
    rows = curs.fetchall()

    req.content_type='text/html'

    outp= ""
    outp += '<tr><td>First Name Entered:&nbsp %s</td></tr>' %(rows)

    req.write(template % outp)
    return apache.OK

=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=

Running the application from Apache i get the following error.

"NOT FOUND"
"The requested URL /test/testlr.py was not found on this server."
"Apache/2.0.52 (MostlyLinux) Server at localhost Port 80"


Please guide.

TIA.
Nitin


More information about the Mod_python mailing list