3

我正在制作一个销售产品的项目,我想在我的 django 中使用贝宝付款。但我收到了这个错误:

“billing_tags”不是有效的标签库:ImportError raise loading loading billing.templatetags.billing_tags:没有名为 Braintree 的模块

在我的settings.py我已经'paypal.standard.ipn'放入INSTALLED_APPSPAYPAL_RECEIVER_EMAIL.

当我检查我的python shell时..

>>> from billing import get_integration
>>> get_integration("pay_pal")
<billing.integrations.pay_pal_integration.PayPalIntegration object at 0x9d41b0c>

这意味着,它正在工作......

在我的urls.py,我有这个:

from billing import get_integration
pay_pal = get_integration("pay_pal")
urlpatterns = patterns('',
    (r'^paypal-ipn-handler/', include(pay_pal.urls)),
)

在我的views.py中:

from billing import get_integration
from paypal.standard.forms import PayPalPaymentsForm
def booking_save_page(request, id):
.....
form = BookTicketForm(request.GET)
if form.is_valid():
    inst = Ticket.objects.create(
               date_select = form.cleaned_data['date_select'],
               product_name = product.name,
               quantity = form.cleaned_data['quantity'],
               totalcost = form.cleaned_data['totalcost'],
               price = form.cleaned_data['price'],
               first_name = form.cleaned_data['first_name'],
               last_name = form.cleaned_data['last_name'],
               contact = form.cleaned_data['contact'],
               product = product,
               client = client,
               trans_code = code,
               email = form.cleaned_data['email'],
               memo = form.cleaned_data['memo'],
               status = 'Pending',
               created = now,
               )
    pay_pal = get_integration("pay_pal")
    pay_pal.add_fields({
           "business": "ccfiel@gmail.com",
           "item_name": product.name,
           "invoice": inst.id,
           "notify_url": settings.BASE_DNS + "/paypal-ipn-handler/",
           "return_url": settings.BASE_DNS + str(client.id) + '/book/'+str(inst.id) +'/success/?booksaved=1',
           "cancel_return": settings.BASE_DNS + str(client.id) + '/?booksaved=0',
           "amount": inst.totalcost})
    form = PayPalPaymentsForm(initial=pay_pal)
    context = {"form": form}
    return render_to_response("pay_pay.html", context)
 ......

我的模板pay_pay.html只有这个:

<h1>Pay Here</h1>
{{ form.render }}

我认为问题在于呈现pay_pay.html我的观点......为什么我得到这个错误:

“billing_tags”不是有效的标签库:ImportError raise loading loading billing.templatetags.billing_tags:没有名为 Braintree 的模块

有人知道我的情况吗?

4

1 回答 1

3

输入pip install braintree终端并重新加载您的服务器。

于 2012-01-11T07:51:13.073 回答