此前一直对博客的代码高亮插件不是很满意。以前用的插件,默认配色方案不是太美观,而且配色方案的修改还不是一件容易的事。
将代码高亮插件换到 Crayon Syntax Highlighter 。现在的这个插件还是让我比较满意的。
插件演示
# -*- coding: UTF-8 -*-
import os
from contextlib import contextmanager as __ctxmgr
from fabric.api import *
from fabric.decorators import runs_once
import fabsettings as cfg
#host settings
env.hosts = ['vicalloy@jstwind.com']
env.password = cfg.PASSWORD
#env.passwords = fabsettings.PASSWORDS
#custom settings
env.deploy_dir = '/home/vicalloy/webapps/jstwind/timeline-site'
env.activate = 'source %s' % os.path.join(env.deploy_dir, 'env/bin/activate')
env.mg = 'python %s' % os.path.join(env.deploy_dir, 'sites', 'manage.py ')
@__ctxmgr
def __virtualenv():
with cd(env.deploy_dir):
with prefix(env.activate):
yield
def reload():
wsgi = os.path.join(env.deploy_dir, 'deploy', 'dj_scaffold.wsgi')
run("touch %s" % wsgi)
def update():
with __virtualenv():
run("git pull")
run('%s syncdb' % env.mg)
run('%s migrate' % env.mg)
run('%s compress --force' % env.mg)
reload()