django.template.exceptions.TemplateDoesNotExist:

django 项目运行良好!主页和其他页面呈现没有问题。我创建产品应用程序/组件页面并意外命名为“模板”模板,因此我将模板重命名为“模板”,当我开始时遇到问题。

我运行了终端命令:

  • python manage.py makemigrations

  • python manage.py 迁移

  • 蟒蛇收集静态

没有任何工作!

我收到一条错误消息:

django.template.exceptions.TemplateDoesNotExist: home.html


繁华开满天机
浏览 146回答 2
2回答

翻翻过去那场雪

尝试将“settings.py”中的当前“TEMPLATES”变量替换为:TEMPLATES = [    {        'BACKEND': 'django.template.backends.django.DjangoTemplates',        'DIRS': [os.path.join(BASE_DIR, 'templates')],        'APP_DIRS': True,    },]

三国纷争

您的应用应添加到 settings.py 中的 INSTALLED_APPSINSTALLED_APPS = [    'name_of_your_app']
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python