你首先要确定渲染的index.html具体是哪一个模板的查找顺序是先从根目录下的templates文件中查找,如果没有找到需要的模板,此时Django会去自己的app下的templates中找模板。如果自己app下的templates中没有这个模板,再去其他app下的templates中查找(查找顺序为INSTALL_APP中的注册顺序)。如果最终所有的templates中都没有找到所需的模板,就会抛出异常
你首先要确定渲染的index.html具体是哪一个
模板的查找顺序是先从根目录下的templates文件中查找,如果没有找到需要的模板,此时Django会去自己的app下的templates中找模板。如果自己app下的templates中没有这个模板,再去其他app下的templates中查找(查找顺序为INSTALL_APP中的注册顺序)。如果最终所有的templates中都没有找到所需的模板,就会抛出异常