Django paypal ipn notify_url未响应

Django paypal ipn notify_url未响应,django,python-2.7,paypal-ipn,django-paypal,Django,Python 2.7,Paypal Ipn,Django Paypal,我的settings.py是: INSTALLED_APPS = ( ......., 'paypal.standard.ipn', ) PAYPAL_RECEIVER_EMAIL = "coolakashsaikia-facilitator@gmail.com" PAYPAL_TEST = True 我的views.py是: @csrf_exempt def pricing(request): paypal_dict_flexible = { "business": "coo

我的
settings.py
是:

INSTALLED_APPS = (
.......,
'paypal.standard.ipn',
)

PAYPAL_RECEIVER_EMAIL = "coolakashsaikia-facilitator@gmail.com"
PAYPAL_TEST = True
我的
views.py
是:

@csrf_exempt
def pricing(request):
  paypal_dict_flexible = {
     "business": "coolakashsaikia-facilitator@gmail.com",
     "amount": "100.00",
     "item_name": "Flexible Subscription",
     "invoice": "10",
     "notify_url": "https://example.com/notify",
     "return_url": "http://example.com/signup",
     "cancel_return": "",
 }

 form = PayPalPaymentsForm(initial=paypal_dict_flexible)
 context = {"form": form, 'current_page': 'pricing'}
 return render_to_response("leavebuddyapp/pricing.html", context)

 @csrf_exempt
 def notify(request):
     return HttpResponse("Notify called")
 urlpatterns = patterns('',
   #Paypal
   (r'^notify', include('paypal.standard.ipn.urls')),

 )
我的
url.py
是:

@csrf_exempt
def pricing(request):
  paypal_dict_flexible = {
     "business": "coolakashsaikia-facilitator@gmail.com",
     "amount": "100.00",
     "item_name": "Flexible Subscription",
     "invoice": "10",
     "notify_url": "https://example.com/notify",
     "return_url": "http://example.com/signup",
     "cancel_return": "",
 }

 form = PayPalPaymentsForm(initial=paypal_dict_flexible)
 context = {"form": form, 'current_page': 'pricing'}
 return render_to_response("leavebuddyapp/pricing.html", context)

 @csrf_exempt
 def notify(request):
     return HttpResponse("Notify called")
 urlpatterns = patterns('',
   #Paypal
   (r'^notify', include('paypal.standard.ipn.urls')),

 )
我的模板是:

 <div class="test">
       {{ form.render }}
       <a href="/signup/flexible" class="btn">Buy now</a>
  </div>

{{form.render}
我的问题是,
views.py
中的函数“
notify
”没有被调用。你们能把我引向正确的方向吗。我不明白我做错了什么。
提前谢谢。

我不知道您为什么认为
/notify
url应该调用您的视图。您的url配置通过包含paypal url配置,将您的
/notify
url指向
paypal.standard.ipn.views.ipn
视图

如果要调用
notify
视图,应将其包含在url配置中:

urlpatterns = patterns('',
    ...
    (r'^notify/$', myapp.views.notify),
)

但是,我非常怀疑您是否愿意为paypal ipn回调编写自己的视图。Django paypal的默认ipn视图包括信号挂钩,您可以在其中轻松添加自己的自定义逻辑

根据文档,您已在URL.py中正确添加了以下行

(r'^notify', include('paypal.standard.ipn.urls')),
上面的代码片段表示
https://example.com/notify
url直接调用paypal pacakge views ipn函数,该函数实际上是为处理ipn响应而设计的

因此@Shivratna您不需要在视图中实现任何其他
notify
功能

在进行paypal交易之前,您能否确保完成以下事项:

  • 通知您的沙箱或live paypal帐户设置中的url是否正确
  • 以及在配置dict
    中,如paypal\u dict\u flexible
  • 假设您已经正确安装了软件包,但不要忘记运行为django paypal软件包创建表的
    python manage.py syncdb

  • 我希望我的建议能给你指明正确的方向;)

    非常感谢…我的错,我已经计算出来了,但是现在当调用默认的ipn视图时,我得到了500个错误。“知道为什么会发生这种事吗…?”希夫拉特纳说,原因很多。发布一个新问题,提供更多信息,如调试日志/回溯。@Shivratna,你做了什么请告诉我,我面临着同样的问题