自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(65)
  • 收藏
  • 关注

django 时区问题

django 1.6 中 支持时区,0、 pip install pytz1、settings.py 设置成:[code="java"]LANGUAGE_CODE = 'zh_cn'TIME_ZONE = 'Asia/Shanghai'USE_I18N = TrueUSE_L10N = TrueUSE_TZ = True[/code]...

2013-11-25 10:40:11 116

原创 python subprocess tips

http://stackoverflow.com/questions/14246292/python-subprocess-call-blockingsubprocess.callblock, and 立刻运行命令p = subprocess.Popen不运行当p.wait 时,开始运行output = subprocess.check_output立刻...

2013-08-26 00:01:14 149

django template 自定义 filter

问题 [url]http://v2ex.com/t/68761#reply7[/url]解决方案:自定义了一个filter( filter 类似于 shell 的管道)[url]http://djangobook.py3k.cn/2.0/chapter09/[/url]具体步骤:1 在 app 目录建 templatetags dir, 包括一个__init__.py 和tag...

2013-05-15 10:27:38 121

原创 git tips2

[b]1 How do you discard unstaged changes in git?[/b]For a specific file use:git checkout path/to/file/to/revertFor all unstaged files use:git checkout -- .Make sure to include the pe...

2013-03-25 11:47:47 97

原创 virtualenvwrapper tips

[color=blue][size=large]安装[/size][/color]pip install virtualenvwrapper 安装完成后,mkdir ~/Envs 这个是你以后创建的所有env的存储的地方然后在 .bash_profileexport WORKON_HOME=~/Envssource /usr/local/bin/virtualenvwrappe...

2013-03-14 11:50:32 79

django south tips

1 安装sudo pip install south在 settings.py 的 installed_app 添加south./manage.py syncb 将south的表同步到db2 south 针对每个app全新的app一./manage.py schemamigration appname --initial在app目录下添加了m...

2012-11-17 11:29:03 83

阿里云ubuntu主机添加监控宝snmpd

今天刚买的阿里云主机基本按 http://yubosun.akcms.com/tech/snmpd-ubuntu.htm注释掉defaultMonitors yes把#agentAddress udp:161,udp6:[::1]:161改成 agentAddress udp:161原因 阿里云禁止了ip6?...

2012-09-18 22:00:50 135

原创 ec2 添加可以用password login 的用户

1 sudo adduser jay2 sudo visudo[code="java"]# User privilege specificationroot ALL=(ALL:ALL) ALLjay ALL=(ALL:ALL) ALL[/code]3 sudo vim /etc/ssh/sshd_config[code="java"]PasswordAuthen...

2012-05-03 11:05:33 128

django1.3 static file

[b]开发时:[/b]1、static file 放在个各个app文件夹的static目录下 以及 settings.py中设置的S TATICFILES_DIRS;2、 settings.py中的STATIC_ROOT 用不到的;[u]3、在urls.py 加入:[code="java"]if settings.DEBUG == True: from django....

2012-04-14 13:23:07 91

mongodb 学习 tip3

q:怎么插入纪录确定唯一性?1 ensure index2 insert(.. save=True)http://stackoverflow.com/questions/1352671/unique-ids-with-mongodbq: mdb.status.find().sort([('updated_at', pymongo.DESCENDING),]):...

2012-03-01 10:24:26 59

bootstrap tips

针对2.01 navbar (导航条) 2种:navbar-fixed-top or not2

2012-02-29 10:09:16 92

mongodb 学习笔记2 - 用mongodb做log server

一[url]https://github.com/andreisavu/mongodb-log[/url]该module包括:1 一个python loggin的handler2 web.py 的简单远程ui (如下图)二用 盛大云 mongoic 做 测试 uri = 'mongodb://user:password@mongoc2.grandcloud.cn:1...

2011-12-26 22:17:50 93

django logging

[url]https://docs.djangoproject.com/en/1.3/topics/logging/[/url][url]http://www.djangocurrent.com/2011/06/django-logging-quickstart-in-django-13.html[/url]

2011-12-25 16:25:46 61

echo server just for debug

用来调试,阻塞、单线程[code="java"]import SocketServerclass EchoRequestHandler(SocketServer.BaseRequestHandler): def handle(self): data = self.request.recv(1024) print data ...

2011-12-13 12:09:34 73

unix bench 测试结果

dell 2850 [url]http://tradearchive.taobao.com/trade/detail/tradeSnap.htm?tradeID=84536591331992[/url][code="java"]======================================================================== B...

2011-12-12 15:42:58 716

ffmpeg

ffmpeg -formats 显示支持的格式ffmpeg -i 视频文件 显示文件信息

2011-11-03 22:16:08 66

原创 Virtualenv 簡單入門 (转载)

转载自 http://blog.gasolin.idv.tw/2010/02/virtualenv.htmlVirtualenv 簡單入門功用使用 Virtualenv 可以讓你預先建立一個虛擬環境,在虛擬環境中開發 Python 程式,可以保持 Python path 乾淨,並減少因為機器上需要同時支援不同版本函式庫,造成各函式庫彼此之間相依性的困擾。而且使用虛擬環境...

2011-09-07 09:15:10 64

原创 mysql tips

删除重复项http://aiyooyoo.com/index.php/archives/357/

2011-08-28 16:57:20 81

mac os 安装 gun core utils

mac上的ls不支持 --ignore 选项解决方法:brew install coreutils然后在 .bash_profie 添加alias ls="gls --color --ignore='*.pyc'"

2011-08-17 16:47:01 483

amazon simple email service (ses) 使用小记(python)

1 需要帐号的 access key2 我采用了python的库 https://github.com/pankratiev/python-amazon-ses-api具体代码如下第一步verify你的发出邮件:[code="java"]from amazon_ses import AmazonSES, EmailMessageAccessKeyID = ...你的...

2011-08-11 22:11:26 851

python redis note

import redisr = redis.Redis()查看所有keysr.keys()or r.keys('*')删除所有keynames = r.keys()r.delete(names)查看key的typer.type(key)redis 文档中文翻译 http://redis.readthedocs.org/en/lates...

2011-07-26 09:43:29 66

pyres 后台队列

pyres 是一个后台消息调控队列1 失败重试 retry_every 每隔多少时间retryretry_timeout 整个retry过程最多用时2 指定时间的任务enqueue_at(a, ...)a是一个datetime类变量,其他的和enqueue一样3 参数必须是 JSON serializable, so 传递个函数就不行not JSON s...

2011-07-17 22:22:18 101

python 包管理note

1 python setup.py develop开发模式:创建链接到当前文件夹,你修改源码,立刻反应出来

2011-07-16 00:38:41 60

jquery 一个简单的tab(选项卡)实现

[code="html"]$(function(){ alert('hello world'); $('#tab-title a').click(function(){ $(this).addClass("selected"); $(this).siblings().removeClass(); va...

2011-06-29 11:24:16 221

mongodb 学习笔记1-mac 安装

1 mac 安装brew install mongodb查看安装的文件 brew list mongodb2 新建数据dirsudo mkdir -p /data/db3 启动server: sudo mongodclient shell: sudo mongo4 pymongohttp://superuser.com/questions/12140...

2011-06-17 17:13:17 68

ubtuntu11.04 开机自动启动某一个程序的方法

参照此文 http://www.onepie.org/2010/03/09/application-autostart-at-boot-time-on-ubuntu/采用了第一种方法需要注意1 需要让bash成为默认的 sudo dpkg-reconfigure dash2 把/usr/local/bin 加入path3 以普通用户执行 sudo -u userna...

2011-05-17 16:30:23 120

原创 nginx+ uwsgi 在ubntu11.04上的安装、配置

[b]0 安装[/b]sudo add-apt-repository ppa:uwsgi/releasehttp://www.zhimaq.com/questions/1151/uwsgi[b]1 uwsgi 的process 接收的信号[/b]http://projects.unbit.it/uwsgi/wiki/uWSGISignals修改代码候,重新载入 kill...

2011-05-13 15:37:07 58

erlang 学习笔记1

mac上装 sudo port install erlangshell:erl快速启动一个计算 n!的例子http://www.erlang.org/quick_start.html

2011-03-22 09:51:33 53

python time模块

http://wiki.python.org/moin/WorkingWithTime1 三种数据格式:seconds:floattuplestring2 数据转化3 In [17]: datetime.datetime.fromtimestamp(time.time())Out[17]: datetime.datetime(2012, 11, 15, ...

2011-03-19 11:14:12 50

pinax 学习1 -- virtulenv

http://simononsoftware.com/virtualenv-tutorial/

2011-03-14 08:29:00 101

原创 fabric mercurial 部署 到 ec2

[url]http://stevelosh.com/blog/2009/01/deploying-site-fabric-and-mercurial/[/url][url]http://www.saltycrane.com/blog/2009/10/notes-python-fabric-09b1/[/url]

2011-02-16 09:31:23 234

python unicode tips

1 mac上ipython 需要用 sudo easy_install -U ipython readline 来修正 中文显示问题2 以下代码 ipython 终端中执行 和py文件直接执行 不一致:[code="python"]u'中' == unicode('中', 'u8')[/code]...

2011-01-24 09:59:58 65

django 服务器 部署方式

1 比较简单好用的 nginx + uwsgi具体见这篇blog http://obmem.info/?p=703要求: ubuntu10。04 +2 用cherrypyhttp://lincolnloop.com/blog/2008/mar/25/serving-django-cherrypy/启动命令(后台):./manage.py runcpserver host...

2010-12-07 11:33:16 96

ubuntu 时间相关tips

1 查看当前时区cat /etc/timezone2 重新设置时区sudo dpkg-reconfigure tzdatahttps://help.ubuntu.com/community/UbuntuTime

2010-11-27 22:04:47 60

jquery 表单验证插件 tips

本文所记的插件是Validation[url]http://docs.jquery.com/Plugins/Validation#Validate_forms_like_you.27ve_never_been_validating_before.21[/url]

2010-11-26 23:22:16 91

python html 转义相关

1ord(s or unicode) 返回十进制 code point;反函数 unichr chr[code]ord(unicode(str, 'u8'))[/code][url]http://crazier9527.iteye.com/blog/411001[/url][url] http://docs.python.org/howto/unicode.html[u...

2010-11-26 21:33:51 64

bitbucket 使用初记

bitbucket.com 最近提供免费的 不公开的代码 hosting 服务。所以试了下,准备作为私人代码库。bitbucket.com采用 mercurial 版本管理工具。mercurial教程http://www.ibm.com/developerworks/cn/opensource/os-cn-mercurial/在bitbucket.com开一个respo...

2010-11-18 09:29:30 208

原创 git tips

svn update 对应的git 操作I use "git clone" to get the initial check out. After that I use "git pull" inside the directory to update the check out, right? Something like following, right? git ...

2010-09-18 21:33:24 74

原创 django form tips

1 f.cleaned_data is dict2 [table]|field|可用widget||choice|select|[/table]

2010-07-05 14:45:53 69

不输入密码,直接用ssh登录远程linux主机的设置

摘自 http://book.douban.com/subject/3800093/两步(存放path按default)1 生成公匙[code="java"]ssh-keygen -t rsa -C 'my key'[/code]2 将公匙copy到server[code="java"]ssh-copy-id -i .ssh/id_rsa.pub jay@serve...

2010-06-12 00:45:49 80

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除