摘要: 在select里面查询到的数据orm里面的要一一对应UserInfo.objects.raw('select id as nid from '其他表')后面的select的不一定是UserInfo表,有可能是是其他表,只要字段名字一样就可以 如果select的是其他表的时候,必须将名字设置为当前Us 阅读全文
posted @ 2018-11-04 21:46 风不再来 阅读(2751) 评论(0) 推荐(0) 编辑
摘要: 第一种方式:RedisCache(redis缓存) ##redis配置# CACHES={# 'default':{#名字default的cache# 'BACKEND':'django_redis.cache.RedisCache',# 'LOCATION':'redis://127.0.0.1: 阅读全文
posted @ 2018-11-04 19:04 风不再来 阅读(1432) 评论(0) 推荐(0) 编辑
摘要: settings里面: 阅读全文
posted @ 2018-11-04 17:44 风不再来 阅读(1880) 评论(0) 推荐(0) 编辑
摘要: Python连接Redis服务器 pool=redis.ConnectionPool(host='127.0.0.1', port=6379,max_connections=1000) conn=redis.Redis(connection_pool=pool) 创建连接池 import redis 阅读全文
posted @ 2018-11-04 17:40 风不再来 阅读(1048) 评论(0) 推荐(0) 编辑
摘要: class Foo(): def __init__(self): self.name=None self.age=19 self.addr='上海' @property def dict(self): #传过来的self是对象,Foo,直接__dict__就是打印出字典的形式 return self 阅读全文
posted @ 2018-11-04 02:05 风不再来 阅读(1770) 评论(0) 推荐(0) 编辑