I am trying to run a simple Python script from my lighttpd server. The HTML code is:
<html>
<title>Interactive page</title>
<body>
<form method=POST action="cgi-bin/cgi101.py">
<P><B>Entery your name: </B>
<P><input type=text name=user>
<P><input type=submit>
</form>
</body>
</html>
My Python script is:
#!/usr/bin/python
import cgi
form = cgi.FieldStorage()
print('Content type:text/html \n')
print('<title>Reply Page</title>')
if not 'user' in form:
print('<h1>who are you</h1>')
else:
print(cgi.escape(form['user'].value))
So my question is, am I able to load the HTML page and then I click on Submit Query? Firefox is asking "You have chosen to open cgi101.py" from localhost and asking what should Firefox do with this file and whether I want to save it. Shouldn't it just open in Firefox and run the Python script rather than asking me to save the Python script?