from django.shortcuts import render_to_response
ImportError: cannot import name 'render_to_response' from 'django.shortcuts' (C:\Users\gtdra\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\shortcuts.py)当我将django-chroniker迁移到我的django项目中时,我遇到了这个错误,我读到render_to_response从Django 2.0开始就被删除了,我该如何修复这个错误?谢谢你
发布于 2020-03-14 13:17:03
render_to_response在django.shortcuts中不可用( render_to_response快捷方式在Django 2.0中已弃用,并在Django 3.0中被删除)。您可以像下面这样使用render
from django.shortcuts import render
def myview(request):
return render(request, 'template.htmll', {'hi': 'hello'})https://stackoverflow.com/questions/60679925
复制相似问题