【发布时间】:2015-08-08 21:50:49
【问题描述】:
我正在使用 django-paypal 库在我的网站上使用 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
reverse函数,如果您的模块作为 Django 视图加载,则您可以免费获得该函数,但如果您以其他方式导入或运行它,则不是。
标签: python django paypal django-paypal