Django 找不到模版报错" django.template.exceptions.TemplateDoesNotExist: index.html"
Posted ❦邪恶毅小人❦
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Django 找不到模版报错" django.template.exceptions.TemplateDoesNotExist: index.html"相关的知识,希望对你有一定的参考价值。
解决办法:在setting.py的TEMPLATES‘DIRS‘[]加入模版路径
os.path.join(BASE_DIR, ‘templates‘)
TEMPLATES = [ { ‘BACKEND‘: ‘django.template.backends.django.DjangoTemplates‘, ‘DIRS‘: [os.path.join(BASE_DIR, ‘templates‘)], #os.path.join(BASE_DIR, ‘templates‘)没了这句, # 会显示django.template.exceptions.TemplateDoesNotExist: index.html ‘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‘, ], }, }, ]
以上是关于Django 找不到模版报错" django.template.exceptions.TemplateDoesNotExist: index.html"的主要内容,如果未能解决你的问题,请参考以下文章