I always created my web services using PHP but I am interested in switching to Python because of its simplicity. On my web server (I have created a "tmp.py") just with one line:
print "Hello!"
And then I have opened this file in my browser. I was surprised that it works (I saw "Hello!"). But there are two more thinks that I need to know:
How do I access the get and post variables as well as the session?
How do I use databases from python. Does Python connects to MySQL server like PHP does or some other approach is used?
解决方案
HOWTO Use Python in the web is the official Python manual on this matter. It's a fairly good starting point, giving a brief overview on the subject, and listing the most common options:
CGI and CGI spin-offs (Fast CGI, WSGI)
mod_python
Full frameworks, most notably Django
Although I admire Python for its elegance and power, it's far from being the natural or standard choice for web development. Carefully consider the use case, and who will maintain the code, before picking the language.