1
from django.http import HttpResponse
from django.template import loader
from .models import Album
def index(request):
all_albums=Album.objects.all()
template= loader.get_template('music/index.html')
context= {
'all_albums': all_albums,
}
return HttpResponse(template.render(context,request))
def detail(request, album_id):
return HttpResponse("<h2>details for album id " + str(album_id) + "
</h2>")
新しいIAMハイテクはジャンゴすると、この問題に直面して コードの一部が です。有効なパスがまだ見えていないにもかかわらず、loader.get_template()でパスに関する問題が発生しています。 –
テンプレートはどこにありますか? 'templates/music/index.html'にありますか? – zaidfazil
あなたのindex.htmlが存在するパスを確認するより良い方法は、あなたのsettings.pyファイルのパスをtemplate_pathに設定することです – ammy