Monday, September 5, 2016

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

Not sure what the issue is without more info about the error, but is the regular expression for that view correct? Assuming that you want to divert folks to the root of your site can you try the following?

url(r'^/$', views.dashboard, name = 'dashboard')


NOTE: if the error still persists, it will help if you include the full traceback in your email.

Yours,
Abraham V.



On Monday, September 5, 2016 at 6:36:37 PM UTC+5:30, arun kumar wrote:
Hi,

   I'm working in Django 1.10 and I got the type error  in the below file at this line " url(r'^$', views.dashboard, name = 'dashboard'),"

from django.conf.urls import include, url
from . import views

urlpatterns = [
    #preview login view
    #url(r'^login/$',views.user_login, name='login')

    # logged - in user dashboard
    url(r'^$', views.dashboard, name = 'dashboard'),

    #login / logout urls
    url(r'^login/$', 'django.contrib.auth.views.login', name='login'),

    url(r'^logout/$', 'django.contrib.auth.views.logout', name='logout'),

    url(r'^logout-then-login/$','django.contrib.auth.views.logout_then_login', name='logout_then_login')

]

I'm new to Django and stuck because of this 

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@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/e58d1158-ad6b-47af-8ae9-be77e08e9ee3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment