基于windows使用fabric将gitlab的文件远程同步到服务器
发布时间:2020-12-14 02:37:07 所属栏目:Windows 来源:网络整理
导读:觉得django项目从本地更新push到gitlab,再执行fabric脚本从gitlab更新服务器项目挺方便的,当然从本地直接到服务器就比较灵活。 # -*- coding: utf-8 -*-from fabric.api import env,runfrom fabric.operations import sudoGIT_REPO = "gitlab-project地址"
觉得django项目从本地更新push到gitlab,再执行fabric脚本从gitlab更新服务器项目挺方便的,当然从本地直接到服务器就比较灵活。 # -*- coding: utf-8 -*- from fabric.api import env,run from fabric.operations import sudo GIT_REPO = "gitlab-project地址" env.user = ‘服务器用户名‘ env.password = ‘服务器用户密码‘ env.hosts = [‘服务器ip‘] env.port = ‘22‘ def deploy(): source_folder = ‘服务器项目目录‘ # 预先把初始项目包含git拷进去 # 执行保留服务器settings配置的pull操作同步gitlab更新到服务器 run(‘cd %s && git stash && git pull && git stash pop‘ % source_folder) run(""" cd {} && pip install -r requirements.txt && python manage.py collectstatic --noinput && python manage.py migrate """.format(source_folder)) sudo(‘supervisorctl restart project_name‘) (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
推荐文章
站长推荐
- Windows Server 2016-查询FSMO角色信息的三种方法
- 无法在Windows上使用单播启动两个ElasticSearch节
- windows – 句柄关闭后,哪种类型的文件会自行删除
- 窗口 – 为什么UTF-8不允许作为“ANSI”代码页?
- windows-server-2008 – Microsoft Essential Bu
- windows平台 pypi打包分发 2019
- windows-server-2008 – 如果要备份HyperV主机,我
- windows-7 – 检查InnoSetup配置文件的[Run]段中
- 窗口 – 这些奇怪的环境变量是什么?
- 更改Windows中的块日志(NTFS)
热点阅读