在视图中使用异步并与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)

以下是我得到的错误

Error image

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)