502承载在Microsoft Azure上且具有特定应用程序路由的Flask应用程序的网关错误

2024-04-20 13:57:51 发布

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

我正在尝试在Microsoft Azure上托管web应用程序。该应用程序用于聊天机器人,并使用Flask和Twilio在Python中进行编码。联机查看网页时-@app.route(“/”)-显示正确。但是当通过Twilio-@app.route('/bot',methods=['GET',POST'])发送消息时,它返回一个502错误。Azure应用程序日志中未显示任何内容

# tester to see response
@app.route("/")
def hello():
    return "Hello world!"

# actual bot logic
@app.route('/bot', methods=['GET', 'POST'])
def bot():
    resp = MessagingResponse()
    # bot logic
    return str(resp)

我应该注意的是,当运行pythonywhere或本地主机时,一切都按照预期运行。来自Twilio的错误消息为

Twilio was unable to fetch content from: http://gbot->initial.azurewebsites.net/bot

Error: Total timeout is triggered. Configured tt is 15000ms and we attempted 1 time(s)

Remote Host: gbot-initial.azurewebsites.net

Request Method: POST

Request URI: http://gbot-initial.azurewebsites.net/bot

URL Fragment: true

我已经用尽了我的资源,希望在这件事上能得到任何帮助


Tags: app应用程序消息getnetbot错误azure