当前位置: 首页>>代码示例>>Python>>正文


Python api.shell_env方法代码示例

本文整理汇总了Python中fabric.api.shell_env方法的典型用法代码示例。如果您正苦于以下问题:Python api.shell_env方法的具体用法?Python api.shell_env怎么用?Python api.shell_env使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在fabric.api的用法示例。


在下文中一共展示了api.shell_env方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: build

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import shell_env [as 别名]
def build(stage, config):
    '''
    Trigger build script to prepare a build for the given stage.
    '''
    info('Getting the build ready for deployment')

    # Trigger the install script
    runner.run_script_safely(known_scripts.PRE_INSTALL, remote=False)
    runner.run_script_safely(known_scripts.INSTALL, remote=False)
    runner.run_script_safely(known_scripts.POST_INSTALL, remote=False)

    env_vars = get_build_env_vars(stage, config)

    with shell_env(**env_vars):
        runner.run_script_safely(known_scripts.PRE_BUILD, remote=False)
        runner.run_script_safely(known_scripts.BUILD, remote=False)
        runner.run_script_safely(known_scripts.POST_BUILD, remote=False) 
开发者ID:kabirbaidhya,项目名称:boss,代码行数:19,代码来源:buildman.py

示例2: deploy

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import shell_env [as 别名]
def deploy(target='dev', sha1=None):
    if sha1 is None:
        # get current working git sha1
        sha1 = local('git rev-parse HEAD', capture=True)
    # server code reset to current working sha1
    home_dir = '/home/pyconkr/{target}.pycon.kr/pyconkr-2016'.format(target=target)

    if target == 'dev':
        python_env = '/home/pyconkr/.pyenv/versions/pyconkr-2016-dev'
    else:
        python_env = '/home/pyconkr/.pyenv/versions/pyconkr-2016'

    with settings(cd(home_dir), shell_env(DJANGO_SETTINGS_MODULE='pyconkr.settings_prod')):
        sudo('git fetch --all -p', user='pyconkr')
        sudo('git reset --hard ' + sha1, user='pyconkr')
        sudo('bower install', user='pyconkr')
        sudo('%s/bin/pip install -r requirements.txt' % python_env, user='pyconkr')
        sudo('%s/bin/python manage.py compilemessages' % python_env, user='pyconkr')
        sudo('%s/bin/python manage.py migrate' % python_env, user='pyconkr')
        sudo('%s/bin/python manage.py collectstatic --noinput' % python_env, user='pyconkr')
        # worker reload
        run('echo r > /var/run/pyconkr-2016-%s.fifo' % target) 
开发者ID:pythonkr,项目名称:pyconapac-2016,代码行数:24,代码来源:fabfile.py

示例3: flatpages_mig

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import shell_env [as 别名]
def flatpages_mig(direction='www'):
    dev_env = '/home/pyconkr/.pyenv/versions/pyconkr-2016-dev/bin/python'
    www_env = '/home/pyconkr/.pyenv/versions/pyconkr-2016/bin/python'
    from_env, to_env = (dev_env, www_env) if direction=='www' else (www_env, dev_env)
    dev_dir = '/home/pyconkr/dev.pycon.kr/pyconkr-2016'
    www_dir = '/home/pyconkr/www.pycon.kr/pyconkr-2016'
    from_dir, to_dir = (dev_dir, www_dir) if direction=='www' else (www_dir, dev_dir)
    with settings(cd(from_dir),
            shell_env(DJANGO_SETTINGS_MODULE='pyconkr.settings_prod')
            ):
        sudo('{python} manage.py dumpdata --indent 2 flatpages -o {fixture_to}'.format(
            fixture_to=os.path.join(to_dir, 'pyconkr', 'fixtures', 'flatpages.json'),
            python=from_env))
    with settings(cd(to_dir),
            shell_env(DJANGO_SETTINGS_MODULE='pyconkr.settings_prod')
            ):
        sudo('{python} manage.py loaddata flatpages'.format(
             python=to_env)) 
开发者ID:pythonkr,项目名称:pyconapac-2016,代码行数:20,代码来源:fabfile.py

示例4: deploy

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import shell_env [as 别名]
def deploy():
    env.host_string = config.HOST_STRING
    with cd('/var/www/test'):
        with shell_env(MODE='PRODUCTION'):
            run('git reset --hard HEAD')
            run('git pull')
            run('npm install')
            run('gulp')
            with prefix('source venv/bin/activate'):
                run('pip install -r requirements.txt')
                run('python manage.py db upgrade')
                run('python manage.py build')
            run('supervisorctl restart test') 
开发者ID:Akagi201,项目名称:learning-python,代码行数:15,代码来源:fabfile.py

示例5: deploy

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import shell_env [as 别名]
def deploy():
    env.host_string = config.HOST_STRING
    with cd('/var/www/#{project}'):
        with shell_env(MODE='PRODUCTION'):
            run('git reset --hard HEAD')
            run('git pull')
            run('npm install')
            run('gulp')
            with prefix('source venv/bin/activate'):
                run('pip install -r requirements.txt')
                run('python manage.py db upgrade')
                run('python manage.py build')
            run('supervisorctl restart #{project}') 
开发者ID:hustlzp,项目名称:Flask-Boost,代码行数:15,代码来源:fabfile.py

示例6: sr

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import shell_env [as 别名]
def sr(*cmd):
    """
    Sudo Run - Wraps a given command around sudo and runs it as the
    www-data user
    """
    with shell_env(HOME='/srv/ifttt'):
        return sudo(' '.join(cmd), user='www-data') 
开发者ID:wikimedia,项目名称:ifttt,代码行数:9,代码来源:fabfile.py

示例7: deploy_static

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import shell_env [as 别名]
def deploy_static():
    bootstrap_environ = {"MAILGUN_WEBHOOK_USER": "foo", "MAILGUN_WEBHOOK_PASS": "foo"}
    with shell_env(**bootstrap_environ):
        with prefix("source .venv/bin/activate"):
            run(
                "cd openprescribing/ && " "python manage.py collectstatic -v0 --noinput"
            ) 
开发者ID:ebmdatalab,项目名称:openprescribing,代码行数:9,代码来源:fabfile.py


注:本文中的fabric.api.shell_env方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。