hi,
i am trying to develop a database application. i am using python as front end and mysql as back end. But now i am getting some problem as "INTERNAL SERVER ERROR" while i am running my application on MAC OS x.
#!/usr/bin/python
import os
import cgi
from cgi import FieldStorage
from cStringIO import StringIO
from sys import exit
header = 'Content-type: text/html'
formhtml = """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html> <head>
<title> customer registrion form </title>
</head>
<center> <body bgcolor=gray>
<h1> Customer Registration Form </h1>
<form action="/cgi-bin/connectionven.py">
<table>
<tr> <td> customer name: </td>
<td><input type=text size=20 name=cusname> </td> </tr>
<tr> <td> city: </td>
<td> <input type=text size=20 name=city> </td> </tr>
<tr> <td> state: </td>
<td> <input type=text size=20 name=state> </td> </tr>
<center>
<tr> <td> <input type=submit name=submit> </td> </tr>
</center>
</table>
</form>
</body> </center>
</html> """
def showForm():
print header + formhtml
def process():
form = cgi.FieldStorage()
if form.has_key('cname'):
name = form.value
elif form.has_key:
city = form.value
elif form.has_key:
state = form.value
if form.has_key:
try:
import MySQLdb
import _mysql_exceptions as DB_EXC
cxn = MySQLdb.connect(user='root')
cur = cxn.cursor()
cur.execute("insert into login.loginform values(%s,%s,%s)",(name,city,state))
cur.close()
cxn.commit()
cxn.close()
except ImportError , e:
return None
else:
showForm()
if __name__ == '__main__':
process()
this is application. is there any other process?? pls give me a valuable reply..