python - django-paypal 教程 : 'reverse' seems to be used incorrectly

标签 python django paypal

我正在尝试使用 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/

相关文章:

python - 从 Pub/Sub 流式传输到 BigQuery

django - 如何记录所有 Django 表单验证错误?

asp.net - 实现礼品卡

python - 如何在没有字符串的情况下获取列表元素

python - PyQt5 自定义标签中不出现滚动条

django - django管理员list_filter太长

php Paypal .一种在接受付款之前验证付款的方法

php - 当我在 CURLOPT_HTTPHEADER 中添加 PayPal-Mock-Response 时出现 404 curl_error

python - SQL根据记录是否存在外键指向它来选择查询记录

django - 使用 root 权限运行 Django API 服务器可以吗?