Python TypeError:视图必须是可调用的,如果是include().hh,则必须是列表/元组
网址 观点 已安装的应用程序Python TypeError:视图必须是可调用的,如果是include().hh,则必须是列表/元组,python,django,Python,Django,网址 观点 已安装的应用程序 =[ from django.shortcuts import render def home(request): return render(request,"home.html",{}) 我需要解决我的问题从视图中导入home函数,并在url模式中使用它,而不是字符串 'newhomaa', 请注意,在Django 1.9+中,您不需要将include()与admin.site.url一起使用 from django.shortcuts import ren
=[
from django.shortcuts import render
def home(request):
return render(request,"home.html",{})
我需要解决我的问题从视图中导入
home
函数,并在url模式中使用它,而不是字符串
'newhomaa',
请注意,在Django 1.9+中,您不需要将
include()
与admin.site.url一起使用
from django.shortcuts import render
def home(request):
return render(request,"home.html",{})
'newhomaa',
from newhomaa.views import home
urlpatterns = [
url(r'^$', home, name='home'),
url(r'^admin/', admin.site.urls),
]