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