本文整理汇总了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)
示例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)
示例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))
示例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')
示例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}')
示例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')
示例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"
)