【问题标题】:GAE Getting Started with Flask (empty firefox browser)GAE Flask 入门(空火狐浏览器)
【发布时间】:2017-12-13 01:12:51
【问题描述】:

我刚刚完成了Getting Start with Flask on App Engine Standard Environment 教程。源代码是here

Firefox 和 Chrome 都是 html 模板,但在本地运行时都不呈现它们:

dev_appserver.py app.yaml

或在云端

gcloud app deploy

FireFox 开发者工具控制台告诉我:

未声明 HTML 文档的字符编码。这 在某些浏览器配置中,文档将呈现乱码 如果文档包含 US-ASCII 范围之外的字符。 页面的字符编码必须在文档中声明或 在传输协议中。

我尝试通过将此行添加到 html 文件来添加声明 UTF-8 编码。

<html>
  <head>
    <meta charset="utf-8"/>
    ...

但无济于事。有什么想法吗?

谢谢!

【问题讨论】:

  • 你试过的URL路径是什么?
  • @Tuxdude 我尝试了以下本地主机:localhost:8080

标签: html python-2.7 google-app-engine firefox flask


【解决方案1】:

我认为这不是您的模板未呈现的原因。但是,要摆脱该错误,请尝试:

<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">

要对您的模板进行故障排除,请提供您的 url 处理程序、视图处理程序和 template.html

【讨论】:

  • # [START handlers] handlers: - url: /static static_dir: static - url: /.* script: main.app # [END handlers]
  • 我添加了建议的元内容(得到与以前相同的响应)
  • 我认为没有视图处理程序,这听起来可能是问题所在。 source code
  • 也没有templates.html,但是有一个templates directory
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-11-28
  • 2012-05-29
  • 2017-05-03
相关资源
最近更新 更多