我正在關注this guide (Python Quickstart: Replying to SMS and MMS Messages)嘗試設置瓶服務器,但是當我嘗試連接到http://localhost:5000
時,出現404錯誤。我可以ping 127.0.0.1沒問題。Flask服務器在localhost上返回404:ww Twilio
代碼:
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
您是否在控制檯輸出中看到任何消息?你是否在服務器的同一臺計算機上運行瀏覽器? – furas
我將我在控制檯中看到的所有內容放在我的帖子中。我在與服務器相同的計算機上運行瀏覽器。 –