fabfile.py 文件源码

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

项目:meetup-facebook-bot 作者: Stark-Mountain 项目源码 文件源码
def configure_nginx_if_necessary():
    nginx_config_path = os.path.join('/etc/nginx/sites-available', env.domain_name)
    if exists(nginx_config_path):
        print('nginx config found, not creating another one')
    else:
        nginx_config_variables = {
            'source_dir': PROJECT_FOLDER,
            'domain': env.domain_name,
            'ssl_params_path': SSL_PARAMS_PATH,
            'fullchain_path': os.path.join(env.letsencrypt_folder, 'fullchain.pem'),
            'privkey_path': os.path.join(env.letsencrypt_folder, 'privkey.pem'),
            'socket_path': SOCKET_PATH
        }
        upload_template(
            filename='deploy_configs/nginx_config',
            destination=nginx_config_path,
            context=nginx_config_variables,
            use_sudo=True
        )
    nginx_config_alias = os.path.join('/etc/nginx/sites-enabled', env.domain_name)
    sudo('ln -sf %s %s' % (nginx_config_path, nginx_config_alias))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号