2017-08-31 151 views
-1

我是新来的Django,和我想要呈现的模板,但它一直显示我此错误时:因为你不templateDoesNotExist错误试图呈现模板

templateDoesNotExist at/
    baseTemplates/base.html 
    Request Method: GET 
    Request URL: http://127.0.0.1:8000/ 
    Django Version: 1.11.4 
    Exception Type: TemplateDoesNotExist 
    Exception Value:  baseTemplates/base.html 
    Exception Location: C:\Users\Sheuntopsax\lib\site-packages\django\template\loader.py 
in get_template, 
    line 25 Python Executable: C:\Users\Sheuntopsax\python.exe 
    Python Version: 3.6.2 
    Python Path:  ['C:\\Users\\Sheuntopsax\\Desktop\\mypicky', 
     'C:\\Users\\Sheuntopsax\\python36.zip', 
     'C:\\Users\\Sheuntopsax\\DLLs', 
     'C:\\Users\\Sheuntopsax\\lib', 
     'C:\\Users\\Sheuntopsax', 
     'C:\\Users\\Sheuntopsax\\lib\\site-packages'] 
+0

它可以是,因为糟糕的'setting.py'文件。你可以在你设置dir baseTemplates的地方粘贴行吗? – AndMar

+0

这是def home(请求)的语法: \t return render(request,“baseTemplates/base.html”,{}) – sheun

+1

带模板的文件夹存在于您的应用程序或外部? – AndMar

回答

0

错误所赐在该路径上有模板。

请遵循此目录结构:让应用程序名称XYZW

xyzw 
    | 
    |---- templates 
      | 
      |-----xyzw 
        | 
        |------ base.html 
        |------ otherFile.html 

然后,内部的任何otherFile.html,写

{% extends 'xyzw/base.html' %}