2

我是 django-paypal 的新手,我试图弄清楚如何运行它。但这是错误阻止我继续。我忽略了什么?我的视图代码只是复制粘贴在 django paypal 的文档中。

请求方法:GET 请求 URL:
Django 版本:1.6 异常类型:KeyError 异常值:(
'True', 'buy') 异常位置:/home/kevcal/.virtualenvs/paypalshit/local/lib/python2.7/site- package/paypal/standard/forms.py 在 get_image,第 143 行 Python 可执行文件:/home/kevcal/.virtualenvs/paypalshit/bin/python Python 版本:2.7.6 Python 路径:
['/home/kevcal/channelfix/resources/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'] 服务器时间:Mon, 22 Dec 2014 15:20:02 +0000

视图.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)

贝宝.html

<h1>Show me the money!</h1>
<!-- writes out the form tag automatically -->
{{ form.render }}
4

0 回答 0