我收到以下错误:
Caught NoReverseMatch while rendering: Reverse for 'satchless-checkout-prepare-order' with arguments '()' and keyword arguments '{}' not found.
但是我安装的应用程序中有satchless.contrib.checkout.common
。在 satchless.contrib.checkout.common
中是一个 urls.py
,其中包含:
from django.conf.urls.defaults import patterns, url
from .views import confirmation, prepare_order, reactivate_order
urlpatterns = patterns('',
url(r'^prepare/$', prepare_order, {'typ': 'satchless_cart'},
name='satchless-checkout-prepare-order'),
url(r'^(?P<order_token>\w+)/confirmation/$', confirmation,
name='satchless-checkout-confirmation'),
url(r'^(?P<order_token>\w+)/reactivate/$', reactivate_order,
name='satchless-checkout-reactivate-order'),
)
为什么我无法从模板调用 {% url satchless-checkout-prepare-order %}
?
最佳答案
您是否已将其包含在根 urlconf 中?
在你的主 urls.py 文件中类似这样的内容:
url(r'^foo/' include('satchless.urls')),
关于Django 不包含已安装应用程序中的 urls.py,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6558489/