1

「example.com/firstsms」というページを設定して、Twilio 経由で SMS を送信し、ホームページにリダイレクトします。その後、電話を使用してメッセージに返信する場合は、確認を返信したいと思います。今のところ、何も起こりません。

urls.py には次のものがあります。

(r'^hellomonkey/$', 'crusher.views.HelloMonkey'),

views.py で、Flask の例を適応させようとしました:

def HelloMonkey(request):
    """Respond to incoming calls with a simple text message."""

    resp = twilio.twiml.Response()
    resp.sms("Hello, Mobile Monkey") 
    return HttpResponseRedirect(str(resp), content_type="text/plain")

私の頭を悩ませます!ありがとう

4

2 に答える 2

3

を返しているHttpResponseRedirectので、いくつかのページにリダイレクトしようとしますが、もちろん機能しません。HttpResponse代わりに次を使用する必要があります。

from django.http import HttpResponse

def HelloMonkey(request):
    """Respond to incoming calls with a simple text message."""

    resp = twilio.twiml.Response()
    resp.sms("Hello, Mobile Monkey") 
    return HttpResponse(str(resp))
于 2013-07-31T22:35:53.320 に答える