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.


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>
<center> <body bgcolor=gray>
<h1> Customer Registration Form </h1>
<form action="/cgi-bin/connectionven.py">
<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>
<tr> <td> <input type=submit name=submit> </td> </tr>
</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:
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))
except ImportError , e:
return None

if __name__ == '__main__':

this is application. is there any other process?? pls give me a valuable reply..

Recommended Answers

All 2 Replies

The first thing I would like to look at is whether or not this is a problem with the server or permissions on the script. So my recommendation would be to run your python script from the command line and see if you get the expected outcome. If so, then you know that the problem is not with your python, but with your web server setup. Start there to narrow down the problem.

hi every one,
i am getting problem when i am trying to run this application on safari. i am using web server which is built in mac os system.
i am getting the following message on my terminal when i am trying to get an error
rajasekhar:CGI-Executables venkata$ /usr/sbin/httpd -E connectionven.py
(13)Permission denied: httpd: could not open error log file connectionven.py.
(13)Permission denied: make_sock: could not bind to address [::]:80
(13)Permission denied: make_sock: could not bind to address
no listening sockets available, shutting down
Unable to open logs

pls give me a valuable reply.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.