我按照 webapp2 上的教程详细创建了一个 hello world 应用程序,但它不起作用
I followed the tutorial on webapp2 for creating a hello world app in detail, but it doesn't work
我已经创建了一个文件夹。
在该文件夹中,
我创造了
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 启动器中单击浏览时,此应用程序应 运行 并显示
Hello, world!
根据教程。
但是当我点击浏览时,浏览器显示一个空网页。
如果我点击 Chrome 中的开发人员工具,我可以看到生成的网站是:
<html>
<head><style type="text/css"></style></head>
<body></body>
</html>
可能出了什么问题?为什么这个简单的 hello world 示例对我不起作用?
编辑:
这是相关教程的 link:
https://webapp-improved.appspot.com/tutorials/gettingstarted/helloworld.html#tutorials-gettingstarted-helloworld
我不确定您使用的是什么教程,但 CGI 风格不适用于 python27 运行时(而且旧版本已经多年不可用了)。你应该使用 actual GAE tutorial.
我已经创建了一个文件夹。
在该文件夹中,
我创造了
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 启动器中单击浏览时,此应用程序应 运行 并显示
Hello, world!
根据教程。
但是当我点击浏览时,浏览器显示一个空网页。
如果我点击 Chrome 中的开发人员工具,我可以看到生成的网站是:
<html>
<head><style type="text/css"></style></head>
<body></body>
</html>
可能出了什么问题?为什么这个简单的 hello world 示例对我不起作用?
编辑:
这是相关教程的 link: https://webapp-improved.appspot.com/tutorials/gettingstarted/helloworld.html#tutorials-gettingstarted-helloworld
我不确定您使用的是什么教程,但 CGI 风格不适用于 python27 运行时(而且旧版本已经多年不可用了)。你应该使用 actual GAE tutorial.