django-paypal教程:“反向”似乎使用不当

时间:2015-06-23 21:43:42

标签: python django paypal

我正在尝试使用django-paypal(也许还有一个更好的库?)我在这里从这个页面学习:https://django-paypal.readthedocs.org/en/stable/standard/ipn.html

在此块reverse中使用但在项目中使用时会引发错误(即使您导入它)

paypal_dict = {
    "business": settings.PAYPAL_RECEIVER_EMAIL,
    "amount": "10000000.00",
    "item_name": "name of the item",
    "invoice": "unique-invoice-id",
    "notify_url": "https://www.example.com" + reverse('paypal-ipn'),
    "return_url": "https://www.example.com/your-return-location/",
    "cancel_return": "https://www.example.com/your-cancel-location/",

}

我这样导入它:

from django.core.urlresolvers import reverse

我收到了这个错误:

NoReverseMatch at /pay/

Reverse for 'paypal-ipn' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []

我错过了什么或教程不完​​整(或错误?);我只需要在这里进行一些修正。

1 个答案:

答案 0 :(得分:2)

问题是我没有在我的网址中添加这个:

url(r'^something/paypal/', include('paypal.standard.ipn.urls')),