fabfile.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:django-project-template 作者: thorgate 项目源码 文件源码
def configure_services():
    """ Updates the services' init files (e.g. for gunicorn)
    """

    require('code_dir')

    # Ensure at-least the default gunicorn.py exists
    with cd(env.code_dir + '/{{ cookiecutter.repo_name }}/settings'):
        if not files.exists('gunicorn.py', use_sudo=True):
            sudo('cp gunicorn.py.example gunicorn.py')

    # Note: DAEMON_TYPE AND DAEMON_FILE_EXTENSION are replaced by hammer automatically
    source_dir = os.path.join(
        env.code_dir,
        'deploy',
        '${DAEMON_TYPE}',
        '${SERVICE_NAME}.${DAEMON_FILE_EXTENSION}',
    )

    # Install the services using hammer
    install_services_cp([
        ('gunicorn-{{cookiecutter.repo_name}}', source_dir.replace('${SERVICE_NAME}', 'gunicorn')),
    ])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号