我正在使用django-paypal
库在我的网站上使用贝宝支付。
在example之后,我设置了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,发生了什么?
您需要导入函数
reverse
:你可以阅读更多关于它的资料。这是django特有的,但看起来你无论如何都在尝试构建一个URL,所以这可能是你想要的。
对于Django>;2.0
在Django2.0中:
reverse
不是python中的内置函数。据推测,它是某个web框架中用于执行反向路由(从名称获取url路径)的函数。notify_url
必须是Paypal将向其发送通知的应用程序中的url。相关问题 更多 >
编程相关推荐