0

我正在 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")),
)

出了什么问题?

4

1 回答 1

-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")),
)
于 2013-03-03T07:19:43.093 回答