2012-01-17 25 views
3

這裏是我的urls.py,我目前收到錯誤:「元組對象沒有屬性正則表達式」。有什麼想法嗎?Caught AttributeError while rendering:元組對象沒有屬性正則表達式

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

您需要在第二組模式上調用'patterns()',儘管我不確定這會自動給出該屬性錯誤。 – geoffspear 2012-01-17 12:17:22

回答

6

您忘記了第二組URL模式周圍的模式。它應該看起來像這樣:

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

謝謝 - 我一直在盯着它一個小時:P。有時候簡單的是最難的。 – locoboy 2012-01-17 12:23:22

相關問題