Flask服务器在localhost:5000 w / Twilio上返回404 [英] Flask server returns 404 on localhost:5000 w/ Twilio
本文介绍了Flask服务器在localhost:5000 w / Twilio上返回404的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我遵循本指南(Python Quickstart:回复SMS和MMS消息)尝试设置一个烧瓶服务器,但是当我尝试连接到 http:// localhost:5000
时,出现404错误。我可以ping 127.0.0.1没问题。
代码:
from flask import Flask,request,redirect
import twilio.twiml
$ b $ app = Flask(__ name__)
@ app.route(/,methods = ['GET','POST'])
def hello_monkey():
用简单的文本消息响应来电。
resp = twilio.twiml.Response()
resp.message(Hello,Mobile Monkey)
return str(resp)
if __name__ ==__main__:
app.run(debug = True)
控制台输出:
*运行于http://127.0.0.1:5000/(按CTRL + C退出)
$ p $重新启动p>
*使用windowsapi reloader
解决方案我可以连接到
http://127.0.0.1:5000/
重新启动我的电脑后。不知道是什么原因造成的。I'm following this guide (Python Quickstart: Replying to SMS and MMS Messages) to try and set up a flask server, but when I try to connect to
http://localhost:5000
I get a 404 error. I can ping 127.0.0.1 no problem.Code:
from flask import Flask, request, redirect import twilio.twiml app = Flask(__name__) @app.route("/", methods=['GET', 'POST']) def hello_monkey(): """Respond to incoming calls with a simple text message.""" resp = twilio.twiml.Response() resp.message("Hello, Mobile Monkey") return str(resp) if __name__ == "__main__": app.run(debug=True)
Console output:
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit) * Restarting with windowsapi reloader
解决方案I can connect to
http://127.0.0.1:5000/
after restarting my computer. Not sure what was causing the issue.这篇关于Flask服务器在localhost:5000 w / Twilio上返回404的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文