python类project_name()的实例源码

fabfile.py 文件源码 项目:service-notifications 作者: rehive 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def set_env(config, version_tag=None):
    """
    Fabric environmental variable setup
    """
    # Bug: when setting this inside a function. Using host_string as workaround
    config_dict = get_config(config)
    env.hosts = [config_dict['HOST_NAME'], ]
    env.host_string = config_dict['HOST_NAME']

    env.project_name = config_dict['PROJECT_NAME']
    env.project_dir = posixpath.join('/srv/images/', env.project_name)
    env.use_ssh_config = True

    env.image_name = config_dict['IMAGE'].split(':')[0]
    env.base_image_name = env.image_name + '_base'
    env.version_tag = version_tag

    env.build_dir = '/srv/build'
    env.local_path = os.path.dirname(__file__)
fabfile.py 文件源码 项目:service-notifications 作者: rehive 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def set_env(config, version_tag=None):
    """
    Fabric environmental variable setup
    """
    # Bug: when setting this inside a function. Using host_string as workaround
    config_dict = get_config(config)
    env.hosts = [config_dict['HOST_NAME'], ]
    env.host_string = config_dict['HOST_NAME']

    env.project_name = config_dict['PROJECT_NAME']
    env.project_dir = posixpath.join('/srv/images/', env.project_name)
    env.use_ssh_config = True

    env.image_name = config_dict['IMAGE'].split(':')[0]
    env.base_image_name = env.image_name + '_base'
    env.version_tag = version_tag

    env.build_dir = '/srv/build'
    env.local_path = os.path.dirname(__file__)
fabfile.py 文件源码 项目:service-notifications 作者: rehive 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def upload():
    """Upload entire project to server"""
    # Bug: when setting this inside a function. Using host_string as workaround
    run('mkdir -p /srv/images/'+env.project_name+'/')
    rsync_project(
        env.project_dir, './',
        exclude=(
            '.git', '.gitignore', '__pycache__', '*.pyc', '.DS_Store', 'environment.yml',
            'fabfile.py', 'Makefile', '.idea', 'bower_components', 'node_modules',
            '.env.example', 'README.md', 'var'
        ), delete=True)

# Wrapper Functions:
fabfile.py 文件源码 项目:service-notifications 作者: rehive 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def wheels():
    """
    Remotely build python binaries on image-factory server
    """
    with lcd(env.local_path):
        put('./requirements.txt', '/srv/build/wheel_requirements.txt')
        put('./etc/base_image/image_requirements.txt',
            '/srv/build/requirements.txt')

    with cd('/srv/build/wheelhouse'):
        run('rm -rf *.whl')

    compose(cmd='-f service.yml -p %s run --rm wheel-factory' %
            env.project_name, path='/srv/build')
fabfile.py 文件源码 项目:service-notifications 作者: rehive 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def upload():
    """Upload entire project to server"""
    # Bug: when setting this inside a function. Using host_string as workaround
    run('mkdir -p /srv/images/'+env.project_name+'/')
    rsync_project(
        env.project_dir, './',
        exclude=(
            '.git', '.gitignore', '__pycache__', '*.pyc', '.DS_Store', 'environment.yml',
            'fabfile.py', 'Makefile', '.idea', 'bower_components', 'node_modules',
            '.env.example', 'README.md', 'var'
        ), delete=True)


# Wrapper Functions:
fabfile.py 文件源码 项目:flask-gulp-starter-kit 作者: hypebeast 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def heroku_bootstrap():
    """Create an app for every environment on Heroku."""
    require('project_name')
    require('environments')

    info('Initializing Heroku apps...')

    set_remotes()

    for environment in env.environments:
        env.environment = environment
        env.app_name = '{}-{}'.format(env.project_name, env.environment)
        heroku_initialize_app()
fabfile.py 文件源码 项目:flask-gulp-starter-kit 作者: hypebeast 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def heroku_configure_app():
    """Configure an app with a basic configuration."""
    require('environment')
    require('project_name')

    info('Configure app: {}'.format(env.app_name))

    local('heroku addons:create heroku-postgresql --remote {}'.format(env.environment))
    local('heroku pg:backups schedule DATABASE --at "04:00 UTC" --remote {}'.format(env.environment))
    local('heroku pg:promote DATABASE_URL --remote {}'.format(env.environment))
    local('heroku config:set SECRET_KEY="{}" --remote {}'.format(create_secret_key(), env.environment))
fabfile.py 文件源码 项目:startupintro 作者: ShubhamBansal1997 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def init(vagrant=False):
    """Prepare a local machine for development."""

    install_requirements()
    local('createdb %(project_name)s' % env)  # create postgres database
    manage('migrate')
fabfile.py 文件源码 项目:DexRoBot 作者: revolter 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def setup():
    run('mkdir -p {0.project_path}/{0.project_name}'.format(env))
    run('ln -s {0.project_path}/{0.project_name} ~/{0.project_name}'.format(env))

    with cd('~/{.project_name}'.format(env)):
        run('virtualenv -p python3 env')
fabfile.py 文件源码 项目:DexRoBot 作者: revolter 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def cleanup():
    run('rm -r ~/{.project_name}'.format(env))
    run('rm -r {0.project_path}/{0.project_name}'.format(env))
fabfile.py 文件源码 项目:DexRoBot 作者: revolter 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def deploy(filename=None):
    with cd('~/{.project_name}'.format(env)):
        if not filename:
            for source_filename in env.source_filenames:
                put('src/{}'.format(source_filename), '~/{.project_name}/'.format(env))

            run('source env/bin/activate; pip install -r requirements.txt')
        else:
            put('src/{}'.format(filename), '~/{.project_name}/'.format(env))


问题


面经


文章

微信
公众号

扫码关注公众号