【发布时间】:2016-11-13 02:44:11
【问题描述】:
我正在关注 this guide (Python Quickstart: Replying to SMS and MMS Messages) 尝试设置烧瓶服务器,但是当我尝试连接到 http://localhost:5000 时,我收到 404 错误。我可以ping 127.0.0.1 没问题。
代码:
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)
控制台输出:
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
* Restarting with windowsapi reloader
【问题讨论】:
-
您在控制台输出中看到任何消息吗?您是否在与服务器相同的计算机上运行浏览器?
-
我将我在控制台中看到的所有内容都放在了我的帖子中。我确实在服务器所在的同一台计算机上运行浏览器。
标签: python flask localhost twilio