gpt4 book ai didi

python - 类型错误 : view must be a callable or a list/tuple when including another urls. py

转载 作者:太空宇宙 更新时间:2023-11-04 09:45:18 25 4
gpt4 key购买 nike

<分区>

我仔细阅读了涵盖该主题的其他几个问题,但是,没有一个描述了 include() 的情况(包括另一个 urls.py 文件)。我还查看了 1.11 文档 here并根据编码进行编码,但是,我不断收到错误“TypeError:view must be a callable or a list/tuple in case of include()”。尝试了这个和其他两个答案的几乎所有推导都无济于事。我的错误/误解在哪里?

网址.py

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

urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^atfl/', include('atfl.urls'), namespace="atfl"),
]

atfl/urls.py 中的代码

from django.conf.urls import url
from atfl.views import home, people

urlpatterns = [
url(r'^$', 'home', name='home'),
url(r'^people/$', 'people', name='people'),
]

atfl/views.py 中的代码

from django.shortcuts import render_to_response

def index(request):
return render_to_response('atfl/home.html', {})

def LoadTextFile(request):
return render_to_response("atfl/people.html", {})

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com