在Azure上托管Flask,点击哪个链接?

2024-05-29 11:15:20 发布

您现在位置:Python中文网/ 问答频道 /正文

enter image description here

正在尝试使用web应用服务在Azure中托管web服务。 也使用SSH访问了shell。在运行PIP安装之后,我运行FLASK_APP=hostAppy.py flask run

# Your API definition
app = Flask(__name__)

@app.route('/predict', methods=['GET'])
def predict():
    print("Inside Predict::")
    return jsonify({'Worked': 'YES'})

if __name__ == '__main__':
    try:
        port = int(sys.argv[1]) # This is for a command-line input
    except:
        port = 12345
    app.run(port=port, host= '0.0.0.0')

尝试hostname-I获取XYZ.0.0.1,其中XYZ不是127 已尝试ping&;从并行打开的同一个终端向http://XYZ.0.0.1:12345/predicthttp://XYZ.0.0.1:5000/predicthttp://127.0.0.1:5000/predict发出curl命令。但被拒绝了。 如何找到要点击的URL


Tags: piprunnamewebapphttpflaskport

热门问题