渲染时捕获AttributeError: 元组对象没有属性regex

3 投票
1 回答
3528 浏览
提问于 2025-04-17 10:25

这是我的urls.py文件,现在我遇到了一个错误:“元组对象没有属性regex”。你们有什么想法吗?

from django.conf.urls.defaults import *
from ecomstore import settings

urlpatterns = patterns('ecomstore.accounts.views',
                       (r'^register/$', 'register', {'template_name':'registration/register.html', 'SSL':settings.ENABLE_SSL}, 'register'),
                       (r'^my_account/$','my_account', {'template_name':'registration/my_account.html'},'my_account'),
                       (r'^order_details/(?P<order_id>[-\w]+)/$', 'order_details', {'template_name':'registration/order_details.html'}, 'order_details'),
                       (r'^order_info//$', 'order_info', {'template_name':'registration/order_info.html'},'order_info'),
)

urlpatterns += ('django.contrib.auth.views', 
                (r'^login/$','login', {'template_name':'registration/login.html', 'SSL':settings.ENABLE_SSL}, 'login'),
)

1 个回答

6

你在第二组网址模式周围忘记加上模式了。它应该是这样的:

urlpatterns += patterns('django.contrib.auth.views', 

撰写回答