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

74 views
Skip to first unread message

Gift Emmanuel Alua

unread,
Oct 12, 2018, 7:16:51 AM10/12/18
to django...@googlegroups.com
Hello everyone,
I am new to Django. I have been following the documentation and getting started with my first app.I get the following TypeError:  view must be a callable or a list/tuple in the case of include(). I added path(r'^polls/$' ,'polls.views.index'), in the mysite url file just because path('polls/', include('polls.urls')), is not supported by Django 2.1. I need help on how to fix this error and continue with learning.

Ігор Магур

unread,
Oct 12, 2018, 8:07:01 AM10/12/18
to Django users
You need to import polls.views, and pass view.index into path func
Ex from polls import views
urlpatterns = [
path('polls/', views.index),
]

Gift Emmanuel Alua

unread,
Oct 12, 2018, 8:26:29 AM10/12/18
to django...@googlegroups.com
Thanks. I fixed it

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/05544735-4b4d-4b66-b4ab-f8aa3d5bd29f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages