我正在制作一个销售产品的项目 我想在我的django中使用paypal付款。但是我收到了这个错误:
'billing_tags'不是有效的标记库:ImportError已加载billing.templatetags.billing_tags:没有名为braintree的模块
在我的settings.py
中,我已将'paypal.standard.ipn'
放入INSTALLED_APPS
和PAYPAL_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已加载billing.templatetags.billing_tags:没有名为braintree的模块
有没有人了解我的情况?
答案 0 :(得分:3)
在终端中输入pip install braintree
并重新加载您的服务器。