tasks.py 文件源码

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

项目:sh8email-django 作者: triplepy 项目源码 文件源码
def deploy(ctx):
    pull_result = ctx.run("git pull")
    if is_task_file_changed(pull_result):
        sys.exit("Pyinvoke task file(s) is changed. Please re-run this task.")
    ctx.run("pip install -r requirements.txt")
    ctx.run("python manage.py makemigrations")
    ctx.run("python manage.py migrate")
    ctx.run("python manage.py collectstatic --noinput")
    # Reload application.
    ctx.run("touch ../reload")
    # Restart receiving server and batch server.
    ctx.run("sudo restart sh8recv", pty=True)
    ctx.run("sudo restart sh8batch", pty=True)
    # Give some time for reloading application.
    time.sleep(1)
    # Test if the site works well.
    with urlopen("https://sh8.email") as response:
        if not response.getcode() == 200:
            sys.exit("CRITICAL: The site respond CODE " + response.getcode())
    # Success!
    print("Deploy succeeded.")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号