HTML输出问题

2024-03-29 09:03:26 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在用python和jinja2在googleappengine中编写一个网站。我的html页面在页面上显示:

Status: 200
Content-Type: text/html;
charset=utf-8
Cache-Control: no-cache
Content-Length: 432

你知道这个问题是从哪里来的吗?另外,为什么{initial_city}}不显示结果?在

我的主.py脚本是:

^{pr2}$

我的html页面:

<!DOCTYPE html>
<html>
  <head>
    <title>
      Deallzz: Chosen City: {{ initial_city }}
    </title>
  </head>
  ...

Tags: textjinja2citytitle网站htmltypestatus
3条回答

造成这个问题的是“印刷交易”。它比任何写入响应在

这只是HTML页面的headers。你应该提供更多关于你正在尝试的信息/代码。在

要显示初始城市,请使用render方法将变量传递给模板:

self.response.out.write(template.render(initial_city = initial_city))

相关问题 更多 >