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

后端 未结 7 2394
北海茫月
北海茫月 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:38

    you will need to import post_home:

    from django.contrib import admin
    from django.urls import path,include
    from django.conf.urls import url
    from posts.views import post_home
    
    urlpatterns = [
        path('admin/', admin.site.urls),
        path('posts/',post_home),
    ]
    

提交回复
热议问题