随笔分类 - Python
摘要:-源码:https://github.com/andymccurdy/redis-py-----redis是否需要密码?http://blog.fens.me/linux-redis-install/-----[跳跃表] -http://zh.wikipedia.org/wiki/%E8%B7%B3...
阅读全文
摘要:1. 使用现有的 python 2.6.x 安装piprpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpmyum install -y python-pip2. 使用 pip安装virtu...
阅读全文
摘要:1 |-flasky 2 3 |-app/ # 可以扩展复制的 app,根据需求 4 |-templates/ 5 |-static/ 6 |-main/ 7 |-__init__.py 8 |-errors.py 9 |-for...
阅读全文
摘要:我在github翻译了 `mysqldb`的文档,欢迎拍砖纠错:)https://github.com/Kevin922/MySQLdb_into_Chinese/blob/master/MySQLdb_in_Chinese.md
阅读全文
摘要:1. 推荐的学习教程:《python简明教程》2. 不推荐的学习教程,可以偶尔查查:《Dive into python》,偶尔查查挺好,看多了走火入魔。3. 推荐一个python群(我自己在里面,@k9):333646237。【不是广告,群里能沟通的也有限,毕竟是天朝】4. 推荐的网站:http:/...
阅读全文
摘要:.├── README.md└── store_management ├── Session.vim ├── auth │ ├── __init__.py │ ├── views.py ├── base │ ├── __init__.py │ ├── views.py ├── set...
阅读全文
摘要:F() 的执行不经过 python解释器,不经过本机内存,是生成 SQL语句的执行。# Tintin filed a news story!reporter = Reporters.objects.get(name='Tintin')reporter.stories_filed += 1report...
阅读全文
摘要:简洁测试:# python -m cProfile test.py代码注入:# -*- coding: utf-8 -*- class test(object): pass class test1(test): pass class test2(test1): pass print...
阅读全文
摘要:1. 不讲安装,没意思2. 使用virtualenv ENV # 建立环境,ENV你可以随便定,看起来像是 mkdir ENVcd ENV # 进目录呗source bin/activate # 启动 沙盒环境,你的命令行的开头,都会有明显的提示变化,哦~【感觉自己萌萌哒】deactivate #...
阅读全文
摘要:# -*- coding: utf-8 -*-class test(object): passclass test1(test): passclass test2(test1): passprint test2.__bases__print type(test2.__bases__...
阅读全文
摘要:1.doc -https://docs.djangoproject.com/en/1.6/topics/settings/from django.conf import settings # 加载settings配置import osos.environ['DJANGO_SETTINGS_MODUL...
阅读全文
摘要:1.安装这个:https://github.com/pydanny/django-wysiwyg2. 下载你希望的 编辑器,到你的指定路径STATIC_ROOT[详细后面补充]
阅读全文
摘要:[omron - debug] user_id建表的时候,不能使用unique,因为一个用户,可能有多个product_id,相对应的是,get_or_create()中的查询参数,如果在建表中有unique,那么get_or_create()就只能唯一使用这个参数.1. 准则:背景: 如果建表 U...
阅读全文
摘要:第一步:# 参数列表 parameters = ('user_id', 'day_time', 'normal_data', 'hourly_data', 'product_id')# 需要传入的参数字典pass_paras = {}# 类似于 loc...
阅读全文
摘要:>>> a = 'hello'>>> b = [1, 2, 3]>>> b.append(a)>>> b[1, 2, 3, 'hello']>>> b.extend(a)>>> b[1, 2, 3, 'hello', 'h', 'e', 'l', 'l', 'o']>>> Fine.
阅读全文
摘要:settings.py : 一个 python语法 写满 变量 的文件。1. 启动主程序中,可能是对 一段我不太明白的代码 的解释:On the server (mod_wsgi)In your live server environment, you’ll need to tell your WSGI application what settings file to use. Do that withos.environ:import osos.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'Read
阅读全文
摘要:wsgi - python web server gateway interface出现的目的是,为了在 python框架开发的时候,更具有通用性。只要符合 wsgi标准,就可以自由选择服务器(nginx, apache等).官网:http://wsgi.readthedocs.org/en/latest/,列出了 支持wsgi的框架, 列出了 支持wsgi的服务器。服务器 ---#--- wsgi协议---#--- python_shell摘wikiWSGI有两方:“服务器”或“网关”一方,以及“应用程序”或“应用框架”一方。服务方调用应用方,提供环境信息,以及一个回调函数(提供给应用程序用
阅读全文
摘要:python处理系统路径的相关操作:# -*- coding: utf-8 -*- import os # 属性print '__file__: %s' % __file__ # 绝对路径(包含文件名)abspath = os.path.abspath(__file__)print('abspath: %s' % abspath) # 路径(剔除文件名)dirn...
阅读全文
摘要:已经安装好的机器:sudo pip freeze > install_list.list 需要安装的机器:sudo pip install -r install_list.list
阅读全文
摘要:1. Code & Official_doc:THIS2. My question.#include /* * 1.PyTypeObject doc, md, 我看了快两天才明白。我是白痴吗? * 这里定义了一个结构体,也就是定义了一个c的类型,名叫 kevin_KevinType. * 2. 回忆一下 c中static, THIS, THIS. */...
阅读全文

浙公网安备 33010602011771号