Python

Python Http连接池

2744 words
HTTP是建立在TCP上面的,一次HTTP请求要经历TCP三次握手阶段,然后发送请求,得到相应数据,最后TCP断开连接。 如果我们要发出多个H

Django QuerySet缓存和迭代器

535 words
Lazy QuerySet A queryset in Django represents a number of rows in the database, optionally filtered by a query. For example, the following code represents all people in the database whose first name is ‘Dave’: person_set = Person.objects.filter(first_name="Dave") The above code doesn’t run any database queries. You can can take the person_set and apply additional filters, or pass

Python变量与参数传递

717 words
Python变量 变量的赋值,只是表示让变量指向了某个对象,并不表示拷贝对象给变量;而一个对象,可以被多个变量所指向。 a = 1 b = a a = a + 1 #

Django数据库连接池

4025 words
数据库长连接 长连接是指程序之间的连接在建立之后,就一直打开,被后续程序重用。使用长连接的初衷是减少连接的开销。 先看看官方文档是怎么讲Djan

Django数据库分表

2087 words
Django ORM没有提供默认的分表功能,给访问分表的数据库带来的不变。那么Django分表怎么实现呢? 分析Django ORM 在实现具体的方案之前,我们先

Python pip配置默认镜像源

202 words
在连接pip官网的时候状况不是很稳定。很多国内镜像站可以使用,加速下载。 使用镜像源很简单,用-i指定就行了: easy_install -i http://pypi.douban.com/simple/ gevent pip install -i http://pypi.douban.com/simple/ gevent 如果觉得太麻烦