[英]Setting up a subscription with Stripe - Django-stripe-payments - Error TemplateDoesNotExist
I am trying to set up a Stripe monthly subscriptions using django-stripe-payments . 我正在尝试使用django-stripe-payments设置Stripe每月订阅。 I have followed the installation instruction and am still having problems.
我已经按照安装说明进行操作,但是仍然遇到问题。
I have added payments into the installed apps but i am getting TemplateDoesNotExist error 我已将付款添加到已安装的应用程序中,但出现TemplateDoesNotExist错误
I have checked .../lib/python2.7/site-packages/payments/templates/payments/templates/payments/_subscribe_form.html and the file is there! 我已经检查过... / lib / python2.7 / site-packages / payments / templates / payments / templates / payments / _subscribe_form.html ,文件就在那里! However the traceback says File does not exist
但是回溯显示文件不存在
view.py view.py
@login_required
def subscribe(request):
form = PlanForm(request.POST or None)
template = 'payments/templates/payments/_subscribe_form.html'
context = {
"form": form,
}
return render(request, template, context)
urls.py urls.py
url(r"^payments/", include("payments.urls")),
Traceback 追溯
TemplateDoesNotExist at /subscriptions/subscribe
payments/templates/payments/_subscribe_form.html
Request Method: GET
Request URL: http://127.0.0.1:8000/subscriptions/subscribe
Django Version: 1.6.5
Exception Type: TemplateDoesNotExist
Exception Value:
payments/templates/payments/_subscribe_form.html
Exception Location: /Users/andysair/Documents/personal/nmninja/lib/python2.7/site-packages/django/template/loader.py in find_template, line 131
Python Executable: /Users/andysair/Documents/personal/nmninja/bin/python
Python Version: 2.7.5
Python Path:
['/Users/andysair/Documents/personal/nmninja/nmninja',
'/Users/andysair/Documents/personal/nmninja/lib/python27.zip',
'/Users/andysair/Documents/personal/nmninja/lib/python2.7',
'/Users/andysair/Documents/personal/nmninja/lib/python2.7/plat-darwin',
'/Users/andysair/Documents/personal/nmninja/lib/python2.7/plat-mac',
'/Users/andysair/Documents/personal/nmninja/lib/python2.7/plat-mac/lib-scriptpackages',
'/Users/andysair/Documents/personal/nmninja/Extras/lib/python',
'/Users/andysair/Documents/personal/nmninja/lib/python2.7/lib-tk',
'/Users/andysair/Documents/personal/nmninja/lib/python2.7/lib-old',
'/Users/andysair/Documents/personal/nmninja/lib/python2.7/lib-dynload',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
'/Users/andysair/Documents/personal/nmninja/lib/python2.7/site-packages']
Server time: Thu, 12 Mar 2015 22:34:56 +1100
Template-loader postmortem
Django tried loading these templates, in this order:
Using loader django.template.loaders.filesystem.Loader:
/Users/andysair/Documents/personal/nmninja/nmninja/templates/payments/templates/payments/_subscribe_form.html (File does not exist)
Using loader django.template.loaders.app_directories.Loader:
/Users/andysair/Documents/personal/nmninja/lib/python2.7/site-packages/django/contrib/admin/templates/payments/templates/payments/_subscribe_form.html (File does not exist)
/Users/andysair/Documents/personal/nmninja/lib/python2.7/site-packages/django/contrib/auth/templates/payments/templates/payments/_subscribe_form.html (File does not exist)
/Users/andysair/Documents/personal/nmninja/lib/python2.7/site-packages/django_forms_bootstrap/templates/payments/templates/payments/_subscribe_form.html (File does not exist)
/Users/andysair/Documents/personal/nmninja/lib/python2.7/site-packages/payments/templates/payments/templates/payments/_subscribe_form.html (File does not exist)
除了在您的INSTALLED_APPS中放入“付款”之外,还可以将base.html文件中的{%扩展“ site_base.html”%}更改为项目的base.html文件,即,将site_base.html替换为项目的base.html文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.