我在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")),
)
出了什么问题?
答案 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")),
)