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

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.

时间: 2024-08-09 03:01:39

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

精简网络框架web.py学习笔记 -《狗嗨默示录》-

web.py 内置了web服务器,代码写完后,将其保存,例如文件名为mywebpy.py,可以用下面的方法来启动服务器: python mywebpy.py 打开你的浏览器输入 http://localhost:8080/ 查看页面. 若要制定另外的端口,使用 python mywebpy.py 1234. URL 处理 任何网站最重要的部分就是它的URL结构.你的URL并不仅仅只是访问者所能看到并且能发给朋友的.它还规定了你网站运行的心智模型.在一些类似del.icio.us的流行网站 , U

CentOS6.5环境中配置Python + Web.py + Apache部署环境

1. 安装apache:    yum install -y httpd httpd-devel     修改/etc/httpd/conf/httpd.conf中的servername等配置,使http://*:*/ 能正常访问 2. 安装python:    wget https://www.python.org/ftp/python/2.7.8/Python-2.7.8.tgz        tar -xzvf Python-2.7.8.tgz    cd Python-2.7.8    

web.py中实现类似Django中的ORM的查询效果

Django中的对象查询 Django框架自带了ORM,实现了一些比较强大而且方便的查询功能,这些功能和表无关.比如下面这个例子: class Question(models.Model): question_text = models.CharField(max_length=200) pub_date = models.DateTimeField('date published') >>> Question.objects.all() >>> Question.ob

耀眼的天才——Aaron Swartz提高效率的秘诀

Aaron Swartz提高效率的秘诀 Aaron Swartz,1986年11月8日-2013年1月11日,一位程序员.作家.政治组织策划人和积极行动主义者.他年仅14岁就参与创造RSS 1.0规格,因而在程式设计圈当中声名大噪. 斯沃茨是 RSS-DEV 工作组的成员,共同创造了 RSS 1.0 的规格,及创建网站框架 web.py 12岁的时候Aaron就创建了一个类似于Wikipedia式的网站(那时还没有Wikipedia),13岁的时候,Aaron赢得为年轻人而设,创作教育及协同非商

Aaron Swartz – 互联网天才开挂的人生历程:每时每刻都问自己,现在这世界有什么最重要的事是我能参与去做的?

Aaron说的一句话让我挺有感触的-- 相信你应该真的每时每刻都问自己,现在这世界有什么最重要的事是我能参与去做的? 如果你没在做那最重要的事,那又是为什么? 1986年11月8日,有个叫Aaron Swartz的人在美国芝加哥伊利诺伊州出生.因为他父母创办了一个软件公司,所以,Aaron在3岁的时候就接触到了电脑,然后就着迷了. 我们先通过Aaron Swartz 的青少年时期来看一下他是怎么样的一个天才: 12岁的时候Aaron就创建了一个类似于Wikipedia式的网站(那时还没有Wiki

Aaron Swartz:如何提高效率

Aaron Swartz:如何提高效率 Aaron Swartz写过一篇很有名的文章,叫做<HOWTO: Be more productive>(如何提高效率).这篇文章写得实在是太好了,我看了好多遍,很赞同作者的观点.我借鉴了作者提到的一些方法并运用到自己的生活中,发现确实有效果,所以我愿意让更多的人看到这篇文章. Aaron Swartz这个人绝对是大牛人,他14时就参与了RSS1.0的制定,他在Stanford读了一年就主动退学了,成为了YC的一员,他的公司后来与reddit合并了,他还

python后端开发:高并发异步uwsgi+web.py+gevent

为什么用web.py? python的web框架有很多,比如webpy.flask.bottle等,但是为什么我们选了webpy呢?想了好久,未果,硬要给解释,我想可能原因有两个:第一个是兄弟项目组用webpy,被我们组拿来主义,直接用了:第二个是我可能当时不知道有其他框架,因为刚工作,知识面有限.但是不管怎么样,webpy还是好用的,所有API的URL和handler在一个文件中进行映射,可以很方便地查找某个handler是为了哪个API服务的.(webpy的其中一个作者是Aaron Swar

Nginx+uwsgi+web.py配置

遇坑的同鞋可以留意一下 操作系统:Centos7 准备文件:Python-2.7.13.tgz下载地址:https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tgznginx-1.12.0.tar.gz下载地址:http://nginx.org/download/nginx-1.12.0.tar.gzuwsgi-2.0.15.tar.gz下载地址:https://projects.unbit.it/downloads/uwsgi-2.0.1

web.py 学习(-)Rocket web框架

Rocket是一个轻量级,多线程,符合WSGI规范的web框架. Rocket使用一个线程监听连接,接收到连接之后放到Queue中,有worker线程进行处理. Rocket含有以下属性: method - A string value indicating the type of Worker to use to answer the requests received by Rocket. The default is wsgi and will invoke the WSGIWorker