Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/19.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 3.x 我的索引页是空的i';我得到了白页_Python 3.x_Django Templates - Fatal编程技术网

Python 3.x 我的索引页是空的i';我得到了白页

Python 3.x 我的索引页是空的i';我得到了白页,python-3.x,django-templates,Python 3.x,Django Templates,我在学习Django,我做了一切,但当我得到一张空白的白纸时。而在源代码中,我只得到标签。我把views.py和index.html放在终端中,我使用的是virtualenv,没有任何错误。当我试图进入这个网站时,我并没有出错 2019年9月24日-18:09:51 Django版本2.2.5,使用设置“Web.settings” 正在启动开发服务器 使用CONTROL-C退出服务器 索引 <!DOCTYPE html> <html> <head> {% fo

我在学习Django,我做了一切,但当我得到一张空白的白纸时。而在源代码中,我只得到标签。我把views.py和index.html放在终端中,我使用的是virtualenv,没有任何错误。当我试图进入这个网站时,我并没有出错 2019年9月24日-18:09:51 Django版本2.2.5,使用设置“Web.settings” 正在启动开发服务器 使用CONTROL-C退出服务器

索引

<!DOCTYPE html>
<html>
<head>
{% for title in titles %}
   <title>{{ titles.title }}</title>
{% endfor %}

</head>
<body>

    {% for post in posts %}
        <h1>{{ post.title }}</h1>
        <p> By {{ post.author}} on {{ post.date_posted }}</p>
        <p> {{ post.concent}} </p>
    {% endfor %}

</body>
</html>

您定义了上下文词典,但没有将其添加到返回中


context = {
    'posts': posts,
}


def about(request):
    return render(request,'blog/shesaxeb.html', context)

context = {
    'posts': posts,
}


def about(request):
    return render(request,'blog/shesaxeb.html', context)