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

Django 1.10之后的版本中,不在使用导入式的写法。直接写类方法即可


1.10以下版本:

urlpatterns = [
    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'),
]

1.10及1.11

urlpatterns = [
    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'),
]

你可能感兴趣的:(python,django,Python,django)