Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Django TemplateDoesNotExist:music/index.html_Python_Django_Web - Fatal编程技术网

Python Django TemplateDoesNotExist:music/index.html

Python Django TemplateDoesNotExist:music/index.html,python,django,web,Python,Django,Web,好的,当我运行服务器并转到it's run Ok时,我的代码中有这个问题,但问题是(我有一个名为website的项目和一个名为music Ok的应用程序,当我转到it's告诉我这个 异常类型:TemplateDoesNotExist 异常值:music/index.html 我的观点.py from django.shortcuts import render from django.http import HttpResponse from .models import Album enter

好的,当我运行服务器并转到it's run Ok时,我的代码中有这个问题,但问题是(我有一个名为website的项目和一个名为music Ok的应用程序,当我转到it's告诉我这个

异常类型:TemplateDoesNotExist 异常值:music/index.html

我的观点.py

from django.shortcuts import render
from django.http import HttpResponse
from .models import Album
enter code here
enter code here
def index(request):
      all_albums = Album.objects.all()
      context = {
         'all_albums': all_albums
       }
       return render(request, 'music/index.html',context)
我的服务器就是这么说的


很抱歉我的英语这么差

我通过将文件夹目录重命名为“templates”解决了这个问题。

添加目录

 'templates'
对你的项目 使用路径

 templates/music/index.html

你能告诉我们你的目录结构吗?比如你想要什么?你的项目是什么样子的。你的文件是如何安排的?首先,你有“music/index.html”文件吗?@DanielRoseman是的,我有