我正在执行中的步骤https://github.com/twilio/starter-python
访问http://localhost:5000/可以得到预期的响应http://localhost:5000/hello只得到404。
这里的部分代码
from flask import Flask, Response, request, render_template
from twilio.twiml.voice_response import VoiceResponse
from twilio.rest import Client
@app.route('/hello', methods=['GET', 'POST'])
def hello():
response = VoiceResponse()
response.say('Hello there! You have successfully configured a web hook.')
response.say('Good luck on your Twilio quest!', voice='woman')
return Response(str(response), mimetype='text/xml')
我实际上在python app.py
上运行了这个例子,唯一的修改是应用程序需要的三个系统环境变量。
我不知道是什么原因造成的。有人能提供线索吗?
我以前也遇到过同样的问题。但我的问题解决了,因为其他一些应用程序正在5000端口上运行。尝试更改端口,我认为它应该有效。尝试引用此堆栈溢出