我正在尝试使用 django-paypal(也许有更好的库?)并且我正在从这里的页面学习:https://django-paypal.readthedocs.org/en/stable/standard/ipn.html
在此 block 中使用了 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: []
要么是我遗漏了什么,要么是教程不完整(或者错误?);我只需要在这里进行一些更正。
最佳答案
问题是我没有在我的网址中添加这个:
url(r'^something/paypal/', include('paypal.standard.ipn.urls')),
关于python - django-paypal 教程 : 'reverse' seems to be used incorrectly,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31014073/