我正在使用 django-paypal
库在我的网站上使用 PayPal 付款。
按照 示例,我设置了 paypal_dict
并添加了表单。
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/",
}
但是,我收到错误 global name 'reverse' is not defined
我正在使用 Python 2.7.9,这是怎么回事?
原文由 Magic 发布,翻译遵循 CC BY-SA 4.0 许可协议
您需要导入函数
reverse
:对于 Django 2.0 及更高版本:
对于较旧的 Django :
它是 django 特有的,但看起来您无论如何都在尝试构建一个 URL,所以它可能就是您想要的。