1
这可能是重复的,但我试图使用从其他的答案RequestContext
但它没有工作对我来说的Django 1.9:CSRF令牌丢失或不正确使用条纹
checkout_test.html:
<form action="" method="POST"> {% csrf_token %}
<script src="https://checkout.stripe.com/checkout.js" class="stripe-button"
data-key="pk_test_37uDrOYvvyyJSLoV0ziJcYyl"
data-amount="2000"
data-name="Demo Site"
data-description="2 widgets ($20.00)"
data-image="/128x128.png"
data-locale="auto">
</script>
</form>
views.py
def user_review_list(request, username=None, errmsg=None):
return render(request, 'checkout_test.html', {})
所以在user_review_list.html
,有由条纹 提供当我填写信息,点击该按钮一个按钮,它会引发错误:
CSRF token missing or incorrect.
我怎样才能解决这个问题?
我已经试图改变render
到render_to_response
与RequestContext
但没有工作
哪个视图给出此错误?您发布了另一个视图的视图和模板。 – Selcuk
@Selcuk对不起,视图渲染模板发布 – ealeon