django错误信息argument to reversed() must be a sequence Request Method:

TypeError at /admin/
argument to reversed() must be a sequence
Request Method:    GET
Request URL:    http://127.0.0.1:8000/admin/
Django Version:    1.11.11
Exception Type:    TypeError
Exception Value:    
argument to reversed() must be a sequence
Exception Location:    /home/python/.virtualenvs/meiduo/lib/python3.5/site-packages/django/urls/resolvers.py in _populate, line 288
Python Executable:    /home/python/.virtualenvs/meiduo/bin/python

 

 

错误原因:

urlpatterns = {
    url(r'^categories/(?P\d+)/hotskus/$',views.HotSKUListView.as_view()),
    url(r'^categories/(?P\d+)/skus/$',views.SKUListView.as_view()),
}

将中括号写成大括号了.

正确写法:

urlpatterns = [
    url(r'^categories/(?P\d+)/hotskus/$',views.HotSKUListView.as_view()),
    url(r'^categories/(?P\d+)/skus/$',views.SKUListView.as_view()),
]

你可能感兴趣的:(python,问题,web,框架)