TypeError: view must be a callable or a list/tuple in the case of include()

后端 未结 7 2467
北海茫月
北海茫月 2020-12-06 10:36

I am new to django and python. During url mapping to views i am getting following error: TypeError: view must be a callable or a list/tuple in the case of include().

<
7条回答
  •  生来不讨喜
    2020-12-06 11:22

    In 1.10, you can no longer pass import paths to url(), you need to pass the actual view function:

    from posts.views import post_home
    
    urlpatterns = [
        ...
        url(r'^posts/$', post_home),
    ]        
    

提交回复
热议问题