Http://blog.chinaunix.net/uid-8581780-id-347984.html
For a fast web development task, I usually choose Karrigell as a tool. Karrigell is intuitive and makes you feel that it's so convenient to develop a Web application. She's a bit like PHP or JSP, but it's definitely not an MVC architecture. If you use Python,karrigell is the PHP you have in hand. You can embed HTML in Python, or you can embed Python in HTML. Very convenient.
In addition, a bit to note, if you want to use your Python as a form of action, then this Python do not use if __name__ = = "__main__", you can directly write code, the above syntax is not supported. Using Karrigell you will feel that the difference between doing the Web programming and the console programming is not great, and for some small, fast-to-frame tasks that are very suitable.
A way to access MySQL and see what's different.
1 ImportMysqldb,pdb,sys2 Try:3conn = MySQLdb.connect (host='192.168.x.x', user='XXX', passwd='XXX', db='XXX')4 exceptexception,e:5 PrintStr (e)6 sys.exit ()7Cur =conn.cursor ()8sql = Unicode ('INSERT INTO Msg_to_send values tablename (NULL, '%s ', '%s ', now ());'% (query["name"],query["School"]),'latin1')9 #Print SQLTen Try: OneCur.execute ("SET NAMES ' GBK '") A cur.execute (SQL) - Conn.commit () - exceptexception,e: the PrintStr (e) - sys.exit () - cur.close () - conn.close () + Print 'ok!'
"reprinted" with Karrigell for rapid web development (connection to MySQL database)