Python Django |在urls.py中导入视图

时间:2017-07-30 23:38:16

标签: python django

我的 urls.py 如下所示:

from django.conf.urls import include, url
from django.contrib import admin

from devicesfor import views
from devicesfor.forms import LoginForm

admin.autodiscover()

list_patterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^', include('devicesfor.urls')),
url(r'^login/$', 'django.contrib.auth.views.login', {'template_name': 'devicesfor/login.html'}),
url(r'^logout/$', 'django.contrib.auth.views.logout', {'next_page': '/login'}),
]

urlpatterns = [
url(r'^', include(list_patterns)),
]

我得到的错误是

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

我知道我必须在你的 urls.py中导入视图。作为一个新手,不能确定如何修改代码并使其符合...

感谢您的帮助!

非常感谢!!

0 个答案:

没有答案