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