我是django-paypal的新手,我试图弄清楚如何运行它。但这是错误阻止我继续。我忽略了什么?我的视图代码只是在django paypal的文档中进行了复制。
请求方法:GET 请求网址:
Django版本:1.6 异常类型:KeyError 例外价值:
('真','买') 例外位置:/home/kevcal/.virtualenvs/paypalshit/local/lib/python2.7/site-packages/paypal/standard/forms.py in get_image,第143行 Python可执行文件:/home/kevcal/.virtualenvs/paypalshit/bin/python Python版本:2.7.6 Python路径:
[ '/家庭/ kevcal / channelfix /资源/ paypalshit', '/home/kevcal/.virtualenvs/paypalshit/lib/python2.7', '/home/kevcal/.virtualenvs/paypalshit/lib/python2.7/plat-i386-linux-gnu', '/home/kevcal/.virtualenvs/paypalshit/lib/python2.7/lib-tk', '/home/kevcal/.virtualenvs/paypalshit/lib/python2.7/lib-old', '/home/kevcal/.virtualenvs/paypalshit/lib/python2.7/lib-dynload', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-i386-linux-gnu', '/usr/lib/python2.7/lib-tk', '/home/kevcal/.virtualenvs/paypalshit/local/lib/python2.7/site-packages', '/home/kevcal/.virtualenvs/paypalshit/lib/python2.7/site-packages'] 服务器时间:星期一,2014年12月22日15:20:02 +0000
views.py
from django.conf import settings
from django.shortcuts import render, render_to_response
from paypal.standard.forms import PayPalPaymentsForm
def view_that_asks_for_money(request):
# What you want the button to do.
paypal_dict = {
"business": settings.PAYPAL_RECEIVER_EMAIL,
"amount": "10000000.00",
"item_name": "name of the item",
"invoice": "unique-invoice-id",
"return_url": "https://www.example.com/your-return-location/",
"cancel_return": "https://www.example.com/your-cancel-location/",
}
# Create the instance.
form = PayPalPaymentsForm(initial=paypal_dict)
context = {"form": form}
return render_to_response("paypal.html", context)
paypal.html
<h1>Show me the money!</h1>
<!-- writes out the form tag automatically -->
{{ form.render }}