运行 虚拟环境中的主管

Run supervisor in virtual environment

我在虚拟环境 (venv) 中安装了 supervisorgunicorn

我正在使用本教程:https://realpython.com/blog/python/kickstarting-flask-on-ubuntu-setup-and-deployment/

我不知道应该在哪里为 supervisor 创建 config 文件,因为默认的 etc/supervisor 不适用于我。

supervisorctl 文件在目录中:

/home/giri/venv/py2.7/lib/python2.7/site-packages/supervisor

我注意到 supervisorctl 文件中的这一行:

Options:
-c/--configuration -- configuration file path (default /etc/supervisord.conf)

我每次 运行 supervisorctl 脚本时都需要手动设置这个标志还是有其他方法?

谢谢

如文档中所述 (http://supervisord.org/configuration.html):

The Supervisor configuration file is conventionally named supervisord.conf. It is used by both supervisord and supervisorctl. If either application is started without the -c option (the option which is used to tell the application the configuration filename explicitly), the application will look for a file named supervisord.conf within the following locations, in the specified order. It will use the first file it finds.

  • $CWD/supervisord.conf
  • $CWD/etc/supervisord.conf
  • /etc/supervisord.conf

因此,将 supervisor.conf 放入当前工作目录即可。