I am new to python and I am trying to design a mobile app with a web server on a raspberry pi. I decided to write the server code using python because I want to control some pins and write on the database on the same server access, so I am wondering how can someone send a response using python CGI? And also if CGI is the best way to deal with python web servers? Or there are better ways to do that? And please if any one knows any link to a good python-server (request response) tutorial post it here.
I tried to return a response using this
#!/usr/bin/env python
import cgi
# print header
print "Content-type: text/html\n\n"
print "<h2>Arguments</h2>"
form = cgi.FieldStorage()
arg1 = form.getvalue('os')
print "OS: " +arg1+"<br>"
if args:
print "response"
print
I found on my search that
if args:
print "response"
print
will return a response "response" but when I tried it on fire bug nothing returned.
Also I found that return statement will give the response but it did not worked also.