【发布时间】:2020-09-20 18:32:21
【问题描述】:
我收到一个错误TypeError: expected str, bytes or os.PathLike object, not tuple 多次尝试从互联网上使用不同的方法,但没有任何效果。谁能帮我解决这个问题。
这是我在 settings.py 文件中的模板部分:
from pathlib import Path
import os
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
TEMPLATE_DIRS = (os.path.join(BASE_DIR / 'templates'),
)
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [TEMPLATE_DIRS,],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
【问题讨论】:
标签: python django django-templates