帮助为django创建fabric deplopment脚本的常用方法

django-fab的Python项目详细描述


有助于为django创建织物开发脚本的常用方法

这样做的目的是允许您使用fabfile.py,它只具有特定项目的独特功能,同时利用版本控制和django任务的通用功能。

您还可以将配置从fabfile.py移到ini样式的配置文件中。

安装

sudo easy_install django-fab
sudo easy_install http://git.fabfile.org/cgit.cgi/fabric/snapshot/fabric-0.9b1.tar.gz

git example fabfile.py

from djangofab.api import *
from django.conf import settings
from djangofab.vcs.git import update_remote, update_local, push, commit, add
env.capture_default = False

# apply the settings from fab.cfg default section
# sets DJANGO_SETTINGS which allows access to django.conf.settings values
apply_settings()

#use the default section of fab.cfg
@user_settings()
def prod():
    "Production settings"
    env.hosts = ['server1']
    env.path = '%(prod_path)s'
    env.giturl = '%(giturl)s'
    env.site_user = 'owner'
    env.site_group = 'group'

@user_settings()
def dev():
    "Development settings"
    env.hosts = ['server1']
    env.path = '%(dev_path)s'
    env.giturl = '%(giturl)s'
    env.site_user = 'owner'
    env.site_group = 'group'

#use the local section
@user_settings('fab.cfg','local')
def localhost():
    "Local settings"
    env.path = '%(dev_path)s'
    env.giturl = '%(giturl)s'

def deploy():
    "Push local changes and update checkout on the remote host"
    push()
    update_remote() # reset and pull on the remote server
    #remote_export()
    change_ownership()
    touch_wsgi()

def test():
    print "website using database %s " % (settings.DATABASE_NAME,)

Requiries面料>;=0.9 http://git.fabfile.org/cgit.cgi/fabric/snapshot/fabric-0.9b1.tar.gz

参见结构文档 http://docs.fabfile.org/

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java在读取属性文件时获取空指针   java NoSuchMethodError:org。springframework。靴子网状物servlet。错误错误控制器。最新SpringCloudStarter NetflixZuul中的getErrorPath()   java Spring不使用相同的JDBC连接   sqlite DB中带方括号的java数据   如何编译基于Maven的Java项目以从命令行运行它   java如何限制cowndown计时器的操作(例如登录)   java如何使用spring和springboot应用程序配置数据库?我想知道如何回答这类问题?   java中的buildpath不支持java。图书馆路径   java如何使用条目集在树映射上迭代?   java如何将IndexOf与Scanner结合使用?   xml Java SAX解析器进程监视   java在多台远程机器上运行并行junit测试   当我尝试在ListView中动态添加项时,单击按钮时java崩溃