python类cd()的实例源码

fabfile.py 文件源码 项目:meetup-facebook-bot 作者: Stark-Mountain 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def start_letsencrypt_setup():
    sudo("mkdir -p /tmp/git")
    sudo("rm -rf /tmp/git/letsencrypt")
    with cd("/tmp/git"):
        sudo("git clone https://github.com/letsencrypt/letsencrypt")
    with cd("/tmp/git/letsencrypt"):
        sudo('./letsencrypt-auto certonly --standalone')
    sudo('rm -rf /tmp/git')
fabfile.py 文件源码 项目:meetup-facebook-bot 作者: Stark-Mountain 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def run_setup_script(script_name, context):
    venv_activate_path = os.path.join(VENV_BIN_DIRECTORY, 'activate')
    venv_activate_command = 'source %s' % venv_activate_path
    with cd(PROJECT_FOLDER), shell_env(**context), prefix(venv_activate_command):
        run('python3 %s' % os.path.join(PROJECT_FOLDER, script_name))
node.py 文件源码 项目:boss 作者: kabirbaidhya 项目源码 文件源码 阅读 36 收藏 0 点赞 0 评论 0
def start_or_reload_service(has_started=False):
    ''' Start or reload the application service. '''
    with cd(buildman.get_deploy_dir()):
        if runner.is_script_defined(constants.SCRIPT_START_OR_RELOAD):
            remote_info('Starting/Reloading the service.')
            runner.run_script(constants.SCRIPT_START_OR_RELOAD)

        elif has_started and runner.is_script_defined(constants.SCRIPT_RELOAD):
            remote_info('Reloading the service.')
            runner.run_script_safely(constants.SCRIPT_RELOAD)

        elif runner.is_script_defined(constants.SCRIPT_START):
            remote_info('Starting the service.')
            runner.run_script(constants.SCRIPT_START)
node.py 文件源码 项目:boss 作者: kabirbaidhya 项目源码 文件源码 阅读 39 收藏 0 点赞 0 评论 0
def reload_service():
    ''' Restart the application service. '''
    with cd(buildman.get_deploy_dir()):
        remote_info('Reloading the service.')
        runner.run_script_safely(constants.SCRIPT_RELOAD)
node.py 文件源码 项目:boss 作者: kabirbaidhya 项目源码 文件源码 阅读 32 收藏 0 点赞 0 评论 0
def stop_service():
    ''' Stop the application service. '''
    with cd(buildman.get_deploy_dir()):
        remote_info('Stopping the service.')
        runner.run_script_safely(constants.SCRIPT_STOP)
node.py 文件源码 项目:boss 作者: kabirbaidhya 项目源码 文件源码 阅读 36 收藏 0 点赞 0 评论 0
def status():
    ''' Get the status of the service. '''
    with cd(buildman.get_current_path()):
        runner.run_script(constants.SCRIPT_STATUS_CHECK)
node.py 文件源码 项目:boss 作者: kabirbaidhya 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def services():
    ''' List the services running for the application. '''
    with cd(buildman.get_current_path()):
        runner.run_script(constants.SCRIPT_LIST_SERVICES)
fabfile.py 文件源码 项目:dprr-django 作者: kingsdigitallab 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def unlock():
    """os x servers need to be unlocked"""
    require('srvr', 'path', 'within_virtualenv', provided_by=env.servers)
    with cd(env.path):
        run('security unlock-keychain')
fabfile.py 文件源码 项目:dprr-django 作者: kingsdigitallab 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def makemigrations(app=None):
    require('srvr', 'path', 'within_virtualenv', provided_by=env.servers)

    if env.srvr in ['dev', 'stg', 'liv']:
        print(yellow('Do not run makemigrations on the servers'))
        return

    with cd(env.path), prefix(env.within_virtualenv):
        run('./manage.py makemigrations {}'.format(app if app else ''))
fabfile.py 文件源码 项目:dprr-django 作者: kingsdigitallab 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def migrate(app=None):
    require('srvr', 'path', 'within_virtualenv', provided_by=env.servers)

    with cd(env.path), prefix(env.within_virtualenv):
        run('./manage.py migrate {}'.format(app if app else ''))
fabfile.py 文件源码 项目:dprr-django 作者: kingsdigitallab 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def update_index():
    require('srvr', 'path', 'within_virtualenv', provided_by=env.servers)

    with cd(env.path), prefix(env.within_virtualenv):
        run('./manage.py build_solr_schema > schema.xml')
        run('mv schema.xml ../../solr/collection1/conf/')
        sudo('service tomcat7-{} restart'.format(env.srvr))
        run('./manage.py update_index')
fabfile.py 文件源码 项目:dprr-django 作者: kingsdigitallab 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def collect_static(process=False):
    require('srvr', 'path', 'within_virtualenv', provided_by=env.servers)

    if env.srvr in ['local', 'vagrant']:
        print(yellow('Do not run collect_static on local servers'))
        return

    with cd(env.path), prefix(env.within_virtualenv):
        run('./manage.py collectstatic {process} --noinput'.format(
            process=('--no-post-process' if not process else '')))
fabfile.py 文件源码 项目:dprr-django 作者: kingsdigitallab 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def install_requirements():
    require('srvr', 'path', 'within_virtualenv', provided_by=env.servers)

    reqs = 'requirements-{}.txt'.format(env.srvr)

    try:
        assert os.path.exists(reqs)
    except AssertionError:
        reqs = 'requirements.txt'

    with cd(env.path), prefix(env.within_virtualenv):
        run('pip install -U -r {}'.format(reqs))
fabfile.py 文件源码 项目:dprr-django 作者: kingsdigitallab 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def reinstall_requirement(which):
    require('srvr', 'path', 'within_virtualenv', provided_by=env.servers)

    with cd(env.path), prefix(env.within_virtualenv):
        run('pip uninstall {0} && pip install --no-deps {0}'.format(which))
fabfile.py 文件源码 项目:dprr-django 作者: kingsdigitallab 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def touch_wsgi():
    require('srvr', 'path', 'within_virtualenv', provided_by=env.servers)

    with cd(os.path.join(env.path, 'dprr')), prefix(env.within_virtualenv):
        run('touch wsgi.py')
fabfile.py 文件源码 项目:dprr-django 作者: kingsdigitallab 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def runserver(port='8000'):
    require('srvr', 'path', 'within_virtualenv', provided_by=env.servers)

    if env.srvr not in ['local', 'vagrant']:
        print(yellow('this server only runs for development purposes'))
        return

    with cd(env.path), prefix(env.within_virtualenv):
        run('./manage.py runserver 0.0.0.0:{}'.format(port))
fabfile.py 文件源码 项目:pyconjp-website 作者: pyconjp 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def manage_run(command, sudo=False):
    """Run a Django management command on the remote server."""
    require('environment')
    manage_base = u"%(virtualenv_root)s/bin/python %(code_root)s/manage.py " % env
    with cd(env.code_root):
        if sudo:
            sudo(u'%s %s' % (manage_base, command))
        else:
            run(u'%s %s' % (manage_base, command))
fabfile.py 文件源码 项目:eshop 作者: djangogirlstaipei 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def create_virtualenv():
    with cd(PROJECT_DIR):
        run('python3 -m venv venv')
fabfile.py 文件源码 项目:eshop 作者: djangogirlstaipei 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def pull_repository():
    with cd(PROJECT_DIR):
        run('git pull origin master')


问题


面经


文章

微信
公众号

扫码关注公众号