添加了应用内模板目录,访问模板的顺序是按照配置文件里面的顺序
This commit is contained in:
parent
3deab8068e
commit
84f2eae72d
@ -53,7 +53,7 @@ ROOT_URLCONF = 'Django5.urls'
|
||||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [BASE_DIR / 'templates']
|
||||
'DIRS': [BASE_DIR / 'templates',BASE_DIR / '/helloWorld/templates']
|
||||
,
|
||||
'APP_DIRS': True,
|
||||
'OPTIONS': {
|
||||
|
||||
10
helloWorld/templates/index2.html
Normal file
10
helloWorld/templates/index2.html
Normal file
@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
</head>
|
||||
<body>
|
||||
应用内模板
|
||||
</body>
|
||||
</html>
|
||||
@ -3,4 +3,4 @@ from django.shortcuts import render
|
||||
|
||||
# Create your views here.
|
||||
def index(request):
|
||||
return render(request, 'index.html')
|
||||
return render(request, 'index2.html')
|
||||
|
||||
Loading…
Reference in New Issue
Block a user