當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。