Hi guys!
Thanks for all the help. I decided to go with the plain cgi module,
but now I am running into a problem. I am not sure if the problem is
in my html code or in the Apache setup. When I click on the button in
the html page, instead of running the Python script, it just returns
the python source code (asking if it must save or open the file). I am
fairly certain that the problem is not in the Python code itself
because it runs fine from the command-line and the file is executable.
I have Apache2 installed (Apache/2.2.9 (Debian) mod_ssl/2.2.9
OpenSSL/0.9.8g mod_jk/1.2.26 PHP/5.2.6-1+lenny3 with Suhosin-Patch
mod_wsgi/2.5 Python/2.5.2 Server at 127.0.0.1 Port 80); added to the
/etc/apache2/httpd.conf file the following line:
ScriptAlias /cgi-bin/ /var/wwww/cumeta/cgi-bin/
Running Python2.5 on Simply Mepis 8.
My html file is pretty simple:
"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"
http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Talk back</title>
</head>
<body>
<form action="./cgi-bin/backchat.py" method="post">
<button name="SubmitBtn" type="submit">Submit</button>
</form>
</body>
</html>
"
What am I missing? Why doesn't it actually run the python script?
(Also pretty straight-forward):
"
#!/usr/bin/env python
import smtplib
import cgi
print "Content-Type: text/html" # HTML is following
print # blank line, end of headers
print "<TITLE>CGI script output</TITLE>"
print "<H1>This is my first CGI script</H1>"
print "Hello, world!"
"
I googled the problem and the best answer I found so far was
"
http://httpd.apache.org/docs/2.0/howto/cgi.html#configuring"
Any ideas?
Chavoux