如何解决在视图中使用异步并与Django3.1中的index.html文件连接
我对Django 3.1几乎一无所知,我还是一个初学者。我已经尝试过但未能解决此错误。因此需要帮助来解决,
应用文件夹下的views.py 文件:
filepath = os.path.join("/full/path/to/R","PROTO.rtf")
index.html 在模板文件夹下:
from django.shortcuts import render
from django.http import HttpResponse
from musicianapp.models import Musician,Album
# Create your views here.
async def index(request):
# await asyncio.sleep(0.5)
musician_list = Musician.objects.order_by("first_name")
diction = {'text_1': "This is a list of Musician !",'musician':musician_list}
return render(request,'musicianapp/index.html',context=diction)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。