01 2012 档案

摘要:web.py的校验码生成2009-12-23 9:28修改自另一位网友的python校验码,原本是用于Django的。因为最近学习web.py的原因,就稍作修改了。这里还需要添加session的处理#coding=utf-8import random, Image, ImageDraw, ImageFont, md5, datetime, ImageColor, StringIO# get random colordef get_color(): colors = ['Black','Orange','Red','Brown',& 阅读全文
posted @ 2012-01-29 16:41 babykick 阅读(482) 评论(0) 推荐(0) 编辑
摘要:一、什么是 WSGI 。在认识 flup 之前,得先认识一下 WSGI 。WSGI 的全称为: Python Web Server Gateway Interface v1.0 (Python Web 服务器网关接口),它是 Python 应用程序和 WEB 服务器之间的一种借口,更多详细的细节,可以参考 PEP333 。它的作用,类似于FCGI 或 FASTCGI 之类的协议的作用。WSGI 的目标,是要建立一个简单的普遍适用的服务器与 WEB 框架之间的接口。WSGI 的特点是:简单、可移植等。二、什么是 flup 。WSGI 还只是一种规范,一种标准,它要完成的作用是用来定义 Pytho 阅读全文
posted @ 2012-01-20 17:20 babykick 阅读(1420) 评论(0) 推荐(0) 编辑
摘要:这是国外网站上的一篇文章,详细的讲解了python wsgi,对理解python的web框架很有帮助原文:http://lucumr.pocoo.org/2007/5/21/getting-started-with-wsgi/Getting Started with WSGIwritten on Monday, May 21, 2007I finally finished the written matura and have some more time to work on projects and write articles. One of the things I wanted to 阅读全文
posted @ 2012-01-20 16:59 babykick 阅读(701) 评论(0) 推荐(0) 编辑
摘要:nginx上用fastcgi配置python环境(一)2010-09-02 17:39:15|分类: Apache/Nginx |标签:wsgiflupfcgipythonnginx |字号大中小订阅 费了2天的功夫,翻阅了无数的中文、英文资料,终于搞定。写下此文留待以后翻阅用 本文环境,centOS 5.4 ,Nignx-0.8.49, Python 2.6.5===================================================================================== WSGI是Python应用程序或框架和Web服务器之间... 阅读全文
posted @ 2012-01-20 15:09 babykick 阅读(1327) 评论(0) 推荐(0) 编辑
摘要:过去的这个月,接触的最多的就是Python的WSGI了,WSGI不是框架不是模块,仅仅是一个规范协议,定义了一些接口,却影响着Python网络开发的方方面面。对于WSGI有这么一段定义:WSGI is theWeb Server Gateway Interface. It is a specification for web servers and application servers to communicate with web applications (though it can also be used for more than that).我想我这篇文章不是详细介绍WSGI内容 阅读全文
posted @ 2012-01-20 15:09 babykick 阅读(4310) 评论(0) 推荐(2) 编辑
摘要:【Python】 Python:locals 和 globals2011-09-09 14:27 64人阅读 评论(0) 收藏 举报静夜思 » 日志 » Python:locals 和 globals热1发表于2010-03-21 23:32 已有678人读过 标签: Python globals localsPython有两个内置的函数,locals 和globals,它们提供了基于字典的访问局部和全局变量的方式。首先,是关于名字空间的一个名词解释。是枯燥,但是很重要,所以要耐心些。Python使用叫做名字空间的东西来记录变量的轨迹。名字空间只是一个字典,它的键字就是变量 阅读全文
posted @ 2012-01-20 11:14 babykick 阅读(3282) 评论(0) 推荐(0) 编辑
摘要:setup { package_data = ['', ['*.txt']]}不起作用,打包为源代码的时候并没有把package下的txt文件放进去。找到setuptools的官方文档,有这么一段话:This tells setuptools to install any data files it finds in your packages. The data files must be under CVS or Subversion control, or else they must be specified via the distutils' 阅读全文
posted @ 2012-01-18 16:15 babykick 阅读(7567) 评论(0) 推荐(0) 编辑
摘要:1. The Engine opens a domain, locates the Spider that handles that domain, and asks the spider for the first URLsto crawl.2. The Engine gets the first URLs to crawl from the Spider and schedules them in the Scheduler, as Requests.3. The Engine asks the Scheduler for the next URLs to crawl.4. The Sch 阅读全文
posted @ 2012-01-17 21:23 babykick 阅读(1365) 评论(0) 推荐(0) 编辑
摘要:模板:1. 在模板内的变量,如果包含有HTML 标记,以$ 方式引用变量的话,HTML 标记只会以纯文本的显示出来。要想HTML 标记产生效果,可以用$: 引用变量。2. 声明变量 $ name="fsdfsdf", 记得$后面要加空格3.模板中使用jquery,web.py模板的$引用会和jquery中定义的$冲突,使用$$代替 阅读全文
posted @ 2012-01-17 09:11 babykick 阅读(327) 评论(0) 推荐(0) 编辑
摘要:id与name的作用,作为标签的标识符,基本上是一样的.name是老方法,id是在name基础上发明的,比name"现代化"一点,用的范围广一点. <A..> 中的name原来(刚发明时)就是用于本页按一下转向过去用的。我们一般认为:ID就像是一个人的身份证号码,显然是唯一的,而Name就像是他的名字,而Name是可以重复的。ID和Name问题描述:在页面里输入了一个input type="hidden",只写了一个ID='SliceInfo',赋值后submit,在后台用Request.Params["SliceI 阅读全文
posted @ 2012-01-15 20:58 babykick 阅读(428) 评论(0) 推荐(1) 编辑
摘要:Python字符编码详解2011-01-03 13:25:45本文简单介绍了各种常用的字符编码的特点,并介绍了在python2.x中如何与编码问题作战 :)请注意本文关于Python的内容仅适用于2.x,3.x中str和unicode有翻天覆地的变化,请查阅其他相关文档。尊重作者的劳动,转载请注明作者及原文地址 >.<转自http://hi.baidu.com/mxp446533129/blog/item/ab55d625d7e95c12918f9df0.html1. 字符编码简介1.1. ASCIIASCII(American Standard Code for Informat 阅读全文
posted @ 2012-01-03 21:17 babykick 阅读(305) 评论(0) 推荐(0) 编辑