Django模板DIRS TemplateDoesNotExist:为什么某些模板被跳过(跳过)?

时间:2019-09-28 17:14:48

标签: python django django-scheduler

我正在尝试django-scheduler的示例项目。当我尝试加载127.0.0.1时,它将为TemplateDoesNotExist抛出base.html。 Debug = True表示:

Django tried loading these templates, in this order:

Using engine django:

django.template.loaders.filesystem.Loader: D:\Code\django-calendar-sample\django-scheduler-sample\project_sample\templates\base.html (Skipped)
django.template.loaders.filesystem.Loader: D:\Code\django-calendar-sample\django-scheduler-sample\project_sample\templates\base.html (Skipped)
django.template.loaders.app_directories.Loader: C:\ProgramData\Anaconda3\lib\site-packages\django\contrib\auth\templates\base.html (Source does not exist)
django.template.loaders.app_directories.Loader: C:\ProgramData\Anaconda3\lib\site-packages\django\contrib\admin\templates\base.html (Source does not exist)
django.template.loaders.app_directories.Loader: C:\ProgramData\Anaconda3\lib\site-packages\debug_toolbar\templates\base.html (Source does not exist)
django.template.loaders.app_directories.Loader: D:\Code\django-calendar-sample\django-scheduler-sample\project_sample\templates\base.html (Skipped)

请注意它显示的前两行(实际上存在base.html的末尾)(已跳过)。他们为什么被跳过?

1 个答案:

答案 0 :(得分:0)

感谢@solarissmoke你是正确的;

base.html中:

{% extends "base.html" %}
{% load i18n %}
{% block extra_head %}
{{ block.super }}
{% endblock %}

{% block rtab_id %}id="schedule_tab"{% endblock %}

{% block subnav %}
<ul>
    {% if user.is_authenticated %}
        <li><a href="">{% trans "Create a Calendar" %}</a></li>
        <li><a href="">{% trans "Your Calendars" %}</a></li>
    {% endif %}

        <li><a href="">{% trans "All Calendars" %}</a></li>
    </ul>
{% endblock %}