'list'对象没有属性'resolve'Python Django

时间:2013-03-03 04:35:08

标签: python django

我在Vista上使用Python Django 1.5。当我尝试访问localhost:8000 / add / producto时,出现以下错误:

AttributeError at /add/producto

list' object has no attribute 'resolve'

addProducto.html下,我有

<html>
    Agregando Producto
</html>

views.py下,我有:

from django.shortcuts import render_to_response
from django.template import RequestContext

def add_product_view(request):
    return render_to_response('ventas/addProducto.html', 
                               context_instance=RequestContext(request))

urls.py下,

from django.conf.urls.defaults import patterns,url

urlpatterns = patterns('','demo.apps.ventas.views', url(r'^add/producto/$', 
                    'add_product_view', name = "vista_agregar_producto")),
)

出了什么问题?

1 个答案:

答案 0 :(得分:-2)

from django.conf.urls.defaults import patterns,url

+++urlpatterns = patterns('demo.apps.ventas.views', url(r'^add/producto/$', 
                    'add_product_view', name = "vista_agregar_producto")),
)



----urlpatterns = patterns('','demo.apps.ventas.views', url(r'^add/producto/$', 
                    'add_product_view', name = "vista_agregar_producto")),
)