Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/302.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python render()缺少1个必需的位置参数:';模板名称';_Python_Django_Django Templates - Fatal编程技术网

Python render()缺少1个必需的位置参数:';模板名称';

Python 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

In是my
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/”)
我使用重定向(“/”)重定向到同一页面

不要发布代码的图像。谢谢