我的app.yml
:
apps:
- script : src/app.py
name: app
instances: 0
exec_mode: fork
pm2 logs
的输出:
$ pm2 logs
0|app | * Running on http://0.0.0.0:8080/ (Press CTRL+C to quit)
0|app | Traceback (most recent call last):
0|app | File "/home/me/src/app.py", line 67, in <module>
0|app | app.run(host='0.0.0.0', port=8080, debug=False)
0|app | File "/usr/local/lib/python2.7/dist-packages/Flask-0.11.1-py2.7.egg/flask/app.py", line 843, in run
0|app | run_simple(host, port, self, **options)
0|app | File "/usr/local/lib/python2.7/dist-packages/Werkzeug-0.10.4-py2.7.egg/werkzeug/serving.py", line 625, in run_simple
0|app | inner()
0|app | File "/usr/local/lib/python2.7/dist-packages/Werkzeug-0.10.4-py2.7.egg/werkzeug/serving.py", line 603, in inner
0|app | passthrough_errors, ssl_context).serve_forever()
0|app | File "/usr/local/lib/python2.7/dist-packages/Werkzeug-0.10.4-py2.7.egg/werkzeug/serving.py", line 512, in make_server
0|app | passthrough_errors, ssl_context)
0|app | File "/usr/local/lib/python2.7/dist-packages/Werkzeug-0.10.4-py2.7.egg/werkzeug/serving.py", line 440, in __init__
0|app | HTTPServer.__init__(self, (host, int(port)), handler)
0|app | File "/usr/lib/python2.7/SocketServer.py", line 419, in __init__
0|app | self.server_bind()
0|app | File "/usr/lib/python2.7/BaseHTTPServer.py", line 108, in server_bind
0|app | SocketServer.TCPServer.server_bind(self)
0|app | File "/usr/lib/python2.7/SocketServer.py", line 430, in server_bind
0|app | self.socket.bind(self.server_address)
0|app | File "/usr/lib/python2.7/socket.py", line 224, in meth
0|app | return getattr(self._sock,name)(*args)
0|app | socket.error: [Errno 98] Address already in use
我的src/app.py
:
if __name__ == '__main__':
print 'Running Flask Server'
app.run(host='0.0.0.0', port=8080, debug=False)
为什么我的应用程序出错?谢谢
我的pm2是2.0.18
答案 0 :(得分:0)
也许您的Flask服务也在运行。尝试杀死它并再次启动pm2