Python Flask端口未在侦听端口中列出

时间:2018-06-06 03:30:08

标签: python docker flask

我有一个简单的烧瓶应用,如下所示。当我启动应用程序时,我看到服务器在终端中启动如下(输出)。但是,当我在容器内部执行lsof -i:5000时。我没有看到这个过程,我无法连接到服务器(使用curl在容器内测试)。我使用docker镜像(FROM python:3)来运行应用程序。任何见解都会有所帮助。感谢

from flask import Flask, abort, request, jsonify
import lib.dataprocessor as dataprocessor

app = Flask(__name__)

@app.route('/normalize', methods=['POST'])
def normalize():
    print("Normalization API invokation ", request.json)
    if not request.json:
        abort(400)

    resultant_list = dataprocessor.standardize(request.json)
    return jsonify(resultant_list)


def start_server():
    print ('Server is starting in port', 5000)
    app.run(host='0.0.0.0', port=5000, debug=True)

输出

Server is starting in port 5000
 * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
 * Restarting with stat
Server is starting in port 5000
 * Debugger is active!
 * Debugger PIN: 327-734-168

0 个答案:

没有答案