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


Python api.prefix方法代码示例

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


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

示例1: log_deploy

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import prefix [as 别名]
def log_deploy():
    current_commit = run("git rev-parse --verify HEAD")
    url = "https://github.com/ebmdatalab/openprescribing/compare/%s...%s" % (
        env.previous_commit,
        current_commit,
    )
    log_line = json.dumps(
        {
            "started_at": str(env.started_at),
            "ended_at": str(datetime.utcnow()),
            "changes_url": url,
        }
    )
    run("echo '%s' >> deploy-log.json" % log_line)
    with prefix("source .venv/bin/activate"):
        run(
            "python deploy/notify_deploy.py {revision} {url} {fab_env}".format(
                revision=current_commit, url=url, fab_env=env.environment
            )
        ) 
开发者ID:ebmdatalab,项目名称:openprescribing,代码行数:22,代码来源:fabfile.py

示例2: call_management_command

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import prefix [as 别名]
def call_management_command(command_name, environment, *args, **kwargs):
    """Invokes management command in environment.

    Prints output of command.
    """

    cmd = "python openprescribing/manage.py {}".format(command_name)

    for arg in args:
        cmd += " {}".format(shlex.quote(arg))

    for k, v in kwargs.items():
        cmd += " --{}={}".format(shlex.quote(k), shlex.quote(v))

    setup_env_from_environment(environment)
    with cd(env.path):
        with prefix("source .venv/bin/activate"):
            print(run(cmd)) 
开发者ID:ebmdatalab,项目名称:openprescribing,代码行数:20,代码来源:fabfile.py

示例3: virtualenv

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import prefix [as 别名]
def virtualenv():
    with cd(env.directory):
        with prefix(env.activate):
            yield 
开发者ID:Hipo,项目名称:university-domains-list-api,代码行数:6,代码来源:fabfile.py

示例4: config_environment

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import prefix [as 别名]
def config_environment():
    sudo('apt-get -y install git screen')
    sudo('adduser crestify --disabled-password --gecos GECOS')
    sudo('locale-gen en_US.UTF-8')
    with settings(sudo_user='crestify', shell='/bin/bash -c'):
        with cd('/home/crestify'):
            sudo('git clone https://github.com/crestify/crestify.git crestify')
            sudo('virtualenv crestifyenv')
            with prefix('source crestifyenv/bin/activate'):
                sudo('pip install -r crestify/requirements.txt') 
开发者ID:dhamaniasad,项目名称:crestify,代码行数:12,代码来源:fabfile.py

示例5: run_migrations

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import prefix [as 别名]
def run_migrations():
    with settings(sudo_user='crestify', shell='/bin/bash -c'):
        with cd('/home/crestify/crestify'):
            with prefix('source ../crestifyenv/bin/activate'):
                sudo('honcho run python main.py db upgrade')  # Run initial migrations 
开发者ID:dhamaniasad,项目名称:crestify,代码行数:7,代码来源:fabfile.py

示例6: _git_update

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import prefix [as 别名]
def _git_update():
    with settings(sudo_user="crestify", shell='/bin/bash -c'):
        with cd('/home/crestify/crestify'):
            with prefix('source ../crestifyenv/bin/activate'):
                with settings(sudo_user='crestify', shell='/bin/bash -c'):
                    sudo('git pull')
                    sudo('pip install -r requirements.txt')
                    sudo('honcho run python main.py db upgrade') 
开发者ID:dhamaniasad,项目名称:crestify,代码行数:10,代码来源:fabfile.py

示例7: kobo_workon

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import prefix [as 别名]
def kobo_workon(_virtualenv_name):
    return prefix('kobo_workon %s' % _virtualenv_name) 
开发者ID:awemulya,项目名称:kobo-predict,代码行数:4,代码来源:fabfile.py

示例8: deploy

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import prefix [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

示例9: act_virtualenv

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import prefix [as 别名]
def act_virtualenv(name):
    with prefix("source ./"+name+"/bin/activate"):
        yield 
开发者ID:sibosend,项目名称:openvpn-admin-ui,代码行数:5,代码来源:fabfile.py

示例10: updatestrings

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import prefix [as 别名]
def updatestrings(runlocal=True, _inside_env=False):
    command = "./manage.py compilemessages"
    if not runlocal or runlocal == "False":
        if _inside_env:
            run(command)
        else:
            with prefix(f"workon {env.site}"):
                run(command)
            site_ctl(command="restart")
    else:
        local(command) 
开发者ID:tejoesperanto,项目名称:pasportaservo,代码行数:13,代码来源:fabfile.py

示例11: deploy

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import prefix [as 别名]
def deploy(mode="full", remote="origin"):
    require("site", provided_by=[staging, prod])
    require("branch", provided_by=[staging, prod])

    with prefix(f"workon {env.site}"):
        checkout(remote, env.branch, False)
        pull(remote, env.branch, False)
        if mode == "full":
            requirements()
            updatestrings(False, _inside_env=True)
            updatestatic()
            migrate()
    if mode != "html":
        site_ctl(command="restart") 
开发者ID:tejoesperanto,项目名称:pasportaservo,代码行数:16,代码来源:fabfile.py

示例12: deploy

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import prefix [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

示例13: update

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import prefix [as 别名]
def update():
    u"""Function defining all steps required to properly update application."""

    # Django app refresh:
    with cd('/var/www/volontulo'):
        run('git checkout -f {}'.format(env_vars[env.host_string]['git_branch']))
        run('git pull')

    with contextlib.nested(
        prefix('workon volontulo'),
        cd('/var/www/volontulo/backend'),
    ):
        run('pip install --upgrade -r requirements/base.txt')

    # Django site refresh:
    with contextlib.nested(
        cd('/var/www/volontulo/backend'),
        prefix('workon volontulo')
    ):
        run('python manage.py migrate --traceback')

    # Angular assets refresh:
    with contextlib.nested(
        prefix('nvm use {}'.format(NODE_VERSION)),
        cd('/var/www/volontulo/frontend'),
    ):
        run('npm install .')
        run('$(npm bin)/ng build --prod --env={}'.format(env.host_string))
        run('$(npm bin)/ng build --prod --env={} --app 1 --output-hashing=false'.format(env.host_string))
        run('./node_modules/.bin/webpack --config webpack.server.config.js --progress --colors')

    run('systemctl restart uwsgi.service')
    run('systemctl restart nginx')
    run('systemctl restart pm2-www-data.service') 
开发者ID:CodeForPoznan,项目名称:volontulo,代码行数:36,代码来源:fabfile.py

示例14: virtualenv

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import prefix [as 别名]
def virtualenv():
    """
    Runs commands within the project's virtualenv.
    """
    with cd(env.venv_path):
        with prefix("source %s/bin/activate" % env.venv_path):
            yield 
开发者ID:keithadavidson,项目名称:ansible-mezzanine,代码行数:9,代码来源:fabfile.py

示例15: install_requirements

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import prefix [as 别名]
def install_requirements():
    with prefix('source {}/venv/bin/activate'.format(PROJECT_DIR)):
        run('pip install -r {}'.format(
            os.path.join(PROJECT_DIR, 'requirements.txt')
        )) 
开发者ID:djangogirlstaipei,项目名称:eshop,代码行数:7,代码来源:fabfile.py


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