我有2个独立的Flask应用程序,mainapp和secondaryapp。但是它们都使用相同的接口和相同的端口。所以我用来运行每个命令的命令是:
gunicorn mainapp:app --bind 0.0.0.0:8000
gunicorn secondaryapp:app --bind 0.0.0.0:8000
Secondaryapp正在运行Nginx并且需要在端口8000上运行。我最初在端口80上运行mainapp,但当我将其更改为在应用程序运行的端口8000上运行时,这不起作用,但现在secondaryapp不运行我收到错误:
2016-06-13 17:27:59,965 DEBG 'app' stderr output:
2016-06-13 17:27:59 [34408] [ERROR] Connection in use: ('0.0.0.0', 80)
如何让主应用程序和辅助应用程序同时运行?
如果有帮助,supervisord.conf文件如下所示:
[program:nginx]
command = service nginx start
autostart = True
[program:mainapp]
command = gunicorn mainapp:app --bind 0.0.0.0:8000
autostart = True
[program:secondaryapp]
command = gunicorn --bind 0.0.0.0:8000 secondaryapp:app
autostart = True
directory = ...