Python render()缺少1个必需的位置参数:';模板名称';
In是myPython render()缺少1个必需的位置参数:';模板名称';,python,django,django-templates,Python,Django,Django Templates,In是myviews.py的代码 我得到一个错误: render() missing 1 required positional argument: 'template_name' 从pycharm运行url时 知道为什么会发生这种情况吗?缺少render()的第一个参数,请按如下方式更新: return render (request,'blabla.html') 查看您的django设置。py“模板”DIRS配置正常 TEMPLATES = [ { 'BACKEND': 'dja
views.py的代码
我得到一个错误:
render() missing 1 required positional argument: 'template_name'
从pycharm
运行url
时
知道为什么会发生这种情况吗?缺少render()的第一个参数,请按如下方式更新:
return render (request,'blabla.html')
查看您的django设置。py“模板”DIRS配置正常
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},]
您可以使用任一渲染(请求“模板名称”)
或重定向(“/template_name/”)
我使用重定向(“/”)重定向到同一页面不要发布代码的图像。谢谢