【问题标题】:Is there an alternative when using supervisor with Gunicorn?将主管与 Gunicorn 一起使用时是否有替代方案?
【发布时间】:2021-08-01 23:21:18
【问题描述】:

我正在创建一个 Flask 应用程序,并在虚拟环境中使用 Nginx 和 Gunicorn。当我启动 Gunicorn 时,gunicorn app:app 一切正常。然后,当我激活主管以保持 gunicorn 处于活动状态时,它给了我一个 500 错误。我正在 var/log/ 中读取我的日志,当我尝试打开一个应该在 subprocess.run(command, capture_output=True, shell=True) 之后创建的文件时发生错误,所以这一行没有正确执行。

当我的腻子关闭时,是否有替代主管来保持我的应用程序运行?

谢谢。

【问题讨论】:

  • 经过大量研究,我发现可以使用systemd、Upstart、Procfile和Runit,这里是文档。 docs.gunicorn.org/en/stable/deploy.html。但是,我想找到一种 gunicorn 拥有的更简单的方法。当您调用 gunicorn 时:gunicorn app:app。您可以简单地使用 --daemon。通过这种方式,您可以制作 gunicorn app:app --daemon。这将使您的系统继续运行。这可能不是最好的选择,但由于我仍在开发中,这就足够了。

标签: gunicorn supervisord


【解决方案1】:

我在这里找到了答案。

https://docs.gunicorn.org/en/stable/deploy.html

它说使用 Runit 是一个不错的选择。

编辑:

我最终使用了名为 --deamon 的 Gunicorn 函数。它很相似,让一切变得更简单。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-11-18
    • 2020-02-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多