本文介绍了你如何守护一个Flask应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用Python编写的使用Flask的小应用程序。现在我正在nohup下运行它,但是我想把它变成daemonize。这样做的正确方法是什么?

进行部署可能是最简单的,安装gunicorn,然后:

 gunicorn项目:app --daemon 

尽管您可能想要使用主管或其他类似的东西来监控gunicorn(至少使用 - pid ,这样你可以轻松地重新加载/停止gunicorn)。

I hav a small application written in Python using Flask. Right now I'm running it under nohup, but I'd like to daemonize it. What's the proper way of doing this?

解决方案

There are several ways to deploy a Flask project. Deploying with gunicorn might be the easiest, install gunicorn and then:

gunicorn project:app --daemon

Although you probably want to use supervisor or something of that nature to monitor gunicorn (at the very least use --pid so you can reload/stop gunicorn easily).

这篇关于你如何守护一个Flask应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-11 10:40