这里会显示出您选择的修订版和当前版本之间的差别。
google:gae:hello-world [2010/08/08 08:47] |
google:gae:hello-world [2010/08/08 08:47] (当前版本) |
||
---|---|---|---|
行 1: | 行 1: | ||
+ | ====== Google App Engine入门(一):Hell World ====== | ||
+ | ===== 程序主文件 helloworld.py ===== | ||
+ | |||
+ | <code python> | ||
+ | print 'Content-Type: text/plain' | ||
+ | print '' | ||
+ | print 'Hello, world!' | ||
+ | </code> | ||
+ | |||
+ | ===== 配置文件 app.yaml ===== | ||
+ | <code> | ||
+ | application: helloworld | ||
+ | version: 1 | ||
+ | runtime: python | ||
+ | api_version: 1 | ||
+ | |||
+ | handlers: | ||
+ | - url: /.* | ||
+ | script: helloworld.py | ||
+ | </code> | ||
+ | |||
+ | ===== 测试应用程序:启动Google App Engine HTTP服务器===== | ||
+ | |||
+ | |||
+ | 用处理程序脚本和配置文件将每个网址映射到处理程序后,应用程序就完成了。您可以立即用 App Engine SDK 附带的网络服务器对其进行测试。 | ||
+ | |||
+ | 用以下命令启动网络服务器,向其提供到 helloworld 目录的路径: | ||
+ | |||
+ | <code> | ||
+ | google_appengine/dev_appserver.py helloworld/ | ||
+ | </code> | ||
+ | |||
+ | 网络服务器正在运行,在端口 8080 监听请求。通过在网络浏览器中访问以下网址测试应用程序: | ||
+ | |||
+ | * http://localhost:8080/ | ||
+ |