无法通过 django http 端点订阅主题

Could not able to subscribe the topic by django http endpoint

我尝试了很多。我关注了 post https://docs.aws.amazon.com/sns/latest/dg/sns-http-https-endpoint-as-subscriber.html 还使我的 ec2 安全组入站更改为任何 http 端口 80。

我也从这里的类似问题中得到了帮助 也在这里

在views.py

def unsub(request):
    content = ""
    if request.POST:
        json1 = request.body.decode('utf-8')
        print(json1)
        f = open('home/json.py','w')
        f.write(json1)
        f.close()

    f = open('home/json.py','r')
    content = f.read()
    f.close()
    return render(request,'home/json.html',{'content':content})

在urls.py

 urlpatterns = [
     path('unsub2',views.unsubscribe,name="unsubscribe"), 
 ]

这是我的 json.html,

<html>
 <head>
 </head>
 <body>
  <p>{{content|safe}}</p>
   <form method="post">
     <input type="text" name="i1" id="i1"></input>
     <input type="text" name="i2" id="i2"></input>
     <button type="submit" >submit</button>
   </form>
  </body></html>

我已经将 sns 主题订阅到 http 端点 http://my-ec2-domain.com/unsub2 但我没有收到任何对该页面的响应,也没有任何响应 logs.Please 告诉我我哪里做错了。 python 3.5 django 2.1.

我想通了。虽然我已经更改了实例的安全组设置,但我忘记在允许的主机设置中添加SNS服务ip。