【问题标题】:I followed the tutorial on webapp2 for creating a hello world app in detail, but it doesn't work我按照 webapp2 上的教程详细创建了一个 hello world 应用程序,但它不起作用
【发布时间】:2015-07-31 06:19:22
【问题描述】:

我已经创建了一个文件夹。

在那个文件夹中,

我已经创建了

app.yaml

它包含:

application: helloworld
version: 1
runtime: python27
api_version: 1
threadsafe: true

handlers:
- url: /.*
  script: helloworld.py

我已经创建了

helloworld.py

它包含:

print 'Content-Type: text/plain'
print ''
print 'Hello, world!'

当我在 Google App Engine 启动器中点击浏览时,该应用程序应该会运行并显示

你好,世界!

根据教程。

但是当我点击浏览时,浏览器显示一个空白网页。

如果我在 Chrome 中点击开发者工具,我可以看到生成的网站是:

<html>
<head><style type="text/css"></style></head>
<body></body>
</html>

可能出了什么问题?为什么这个简单的 hello world 示例对我不起作用?

编辑:

以下是相关教程的链接: https://webapp-improved.appspot.com/tutorials/gettingstarted/helloworld.html#tutorials-gettingstarted-helloworld

【问题讨论】:

  • 不确定开始该教程的目的是向您展示真正古老且不推荐的做事方式,但您可以安全地跳过该步骤并转到“下一步。 ..”页面底部的部分,然后单击“Continue to Using the webapp2 Framework”。它开始向您展示处理请求的更好方法。或者您也可以使用下面答案中建议的链接。
  • 那不是官方教程,看起来不对。使用 Google 的教程。

标签: python google-app-engine webapp2


【解决方案1】:

我不确定您使用的是哪个教程,但 CGI 样式不适用于 python27 运行时(并且较旧的样式已多年不可用)。你应该使用actual GAE tutorial

【讨论】:

    猜你喜欢
    • 2013-09-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-14
    • 1970-01-01
    • 2013-01-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多