惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Application and Cybersecurity Blog
Application and Cybersecurity Blog
A
About on SuperTechFans
S
SegmentFault 最新的问题
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Help Net Security
Help Net Security
有赞技术团队
有赞技术团队
博客园 - 【当耐特】
O
OpenAI News
美团技术团队
月光博客
月光博客
Apple Machine Learning Research
Apple Machine Learning Research
Schneier on Security
Schneier on Security
Webroot Blog
Webroot Blog
Cyberwarzone
Cyberwarzone
Hacker News - Newest:
Hacker News - Newest: "LLM"
Google Online Security Blog
Google Online Security Blog
T
Tenable Blog
S
Security Affairs
博客园_首页
S
Schneier on Security
Security Latest
Security Latest
T
Threat Research - Cisco Blogs
T
Tailwind CSS Blog
大猫的无限游戏
大猫的无限游戏
Spread Privacy
Spread Privacy
量子位
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
K
Kaspersky official blog
Hugging Face - Blog
Hugging Face - Blog
TaoSecurity Blog
TaoSecurity Blog
博客园 - 聂微东
Vercel News
Vercel News
M
MIT News - Artificial intelligence
T
Troy Hunt's Blog
B
Blog
MongoDB | Blog
MongoDB | Blog
Martin Fowler
Martin Fowler
Attack and Defense Labs
Attack and Defense Labs
L
LINUX DO - 最新话题
D
DataBreaches.Net
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Stack Overflow Blog
Stack Overflow Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
博客园 - Franky
W
WeLiveSecurity
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
F
Fortinet All Blogs
www.infosecurity-magazine.com
www.infosecurity-magazine.com
C
Check Point Blog
H
Hacker News: Front Page

博客园 - 网际飞狐

异步服务框架 如何在TFS中用命令行提交更新 CollabNet Subversion 输出自定义日期格式 - 网际飞狐 - 博客园 你正确关闭WCF链接了吗? 通过OperationContext添加消息头信息 PHP在II7安装指南 在IIS7中配置使用Python 2008年12月小记(NewSequentialID(),ADO.NET Data Service,Visual Studio Tips,安装Django,JQuery智能感知) [OpenAPI] html标签分析 System.Web.Routing 使用基础 Notes for 2008-11(GetRange, backup,file hash, PostRequest, QueryString) JS通过服务代理调用跨域服务 对硬编码WCF服务的封装(提供服务和客户端调用的封装,调用样例....) Observer Pattern, Delegate and Event How to view the W3WP process by c#? 项目框架概要 2008年10月小记(SQL删除重复记录,生成表结构,字符串特性,statistics io) WinDbg使用摘要
[Google App Engine] Hello, world!
网际飞狐 · 2008-12-22 · via 博客园 - 网际飞狐

1、在Google App Engine 注册一个应用程序。应用程序注册后会分配给你一下域名,例如:xxx应用程序,分配的就是xxx.appspot.com。

2、Google App Engine的开发使用的Python,所以如果你要在本地进行调试的话,就需要配置本地环境, 可以使用Google提供的SDK中提供的服务器,当然也可以使用iis来运行啦!看一下在IIS7中配置使用Python 。要注意的是Google服务器用的是Python2.5,虽然Python已经出到3.0了,但是为了方便统一性,还是建议你装2.5.2版本吧。

3、现在可以创建我们第一个页面了home.py。内容简单极了,就是print一些字符串:

print 'Status: 200 OK'
print 'Content-Type: text/html'
print ''
print '<html><head><title>Hello World</title></head>'
print '<body>'
print '<h1>Hello, world! This is my home!</h1>'
print '</body>'
print '</html>'

4、现在有了页面了,如何发布到xxx.appspot.com上呢?

Google提供的SDK中有一个工具appcfg.py专门就是用来上传应用程序到Google App Engine的。一般可以如下调用:

appcfg.py  update ../WebSite

或者

appcfg.py --email=xxx@gmail.com update ../WebSite

其中"../WebSite"就是相对于命令运行目录而言的应用程序所在的目录。例如我当前运行appcfg.py的目录是""IWebCache\src\WebSite",所以就用../WebSite来表明要上传的相对目录是WebSite

如果不想每次上传都写Google的登录email,这样就可以指定--email参数。

5、appcfg.py上传应用程序还需要一个配置文件app.yaml

application: iwebcache
version: 
1
runtime: python
api_version: 
1

handlers:

- url: /
  script: home.py
  
- url: /index\.html
  script: home.py
  
- url: /.*
  script: not_found.py

配置文件的具体用户看一下上页面链接就可以,不过这里说一下要注意的地方,appcfg.py在上传文件之前会检查app.yaml文件的格式正确性,不过有个问题是

- url: /
  script: home.py

这样的配置中在script之前必须要有两个空格,否则就会报错。

      好了,现在执行一下上传命令,就可以看到你的页面了。GoogleAppEngineWebSite.rar