码迷,mamicode.com
首页 > Web开发 > 详细

Aaron Swartz Rewriting Reddit中关于web.py的创建思路

时间:2014-11-06 19:12:15      阅读:259      评论:0      收藏:0      [点我收藏+]

标签:http   io   ar   os   for   on   art   cti   html   

So how should things work? The first principle is that code should be clear and simple. If you want to output some text, you call web.output. If you want to get form input, you call web.input. There’s nothing particularly hard to remember.

The second principle is that web.py should fit your code, not the other way around. Every function in web.py is completely independent, you can use whichever ones you want. You can put your files wherever you like, and web.py will happily follow along. If you want a piece of code to be run as a web app, you call web.run, you don’t put your code in the magical place so that web.py can run you.

The third principle is that web.py should, by default, do the right thing by the Web. This means distinguishing between GET and POST properly. It means simple, canonical URLs which synonyms redirect to. It means readable HTML with the proper HTTP headers.

Aaron Swartz Rewriting Reddit中关于web.py的创建思路

标签:http   io   ar   os   for   on   art   cti   html   

原文地址:http://www.cnblogs.com/TLightSky/p/4079337.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!