<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>乐趣参与 &#187; GAE</title>
	<atom:link href="http://leqcany.com/tag/gae/feed" rel="self" type="application/rss+xml" />
	<link>http://leqcany.com</link>
	<description>年轻、态度、折腾、生活。</description>
	<lastBuildDate>Wed, 09 Jun 2010 13:48:42 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Google App Engine 动手玩</title>
		<link>http://leqcany.com/2009/10/google-app-engine.html</link>
		<comments>http://leqcany.com/2009/10/google-app-engine.html#comments</comments>
		<pubDate>Sat, 17 Oct 2009 16:35:06 +0000</pubDate>
		<dc:creator>leplay</dc:creator>
				<category><![CDATA[推荐&分享]]></category>
		<category><![CDATA[GAE]]></category>
		<category><![CDATA[google]]></category>

		<guid isPermaLink="false">http://leqcany.com/?p=715</guid>
		<description><![CDATA[&#160;&#160;&#160;&#160; 好吧，我承认我刚刚看过瘾科技的订阅，所以才起了一个这样的标题。
&#160;&#160;&#160;&#160; 以前只是用过由Google App  Engine搭建的服务，像一些代理之类的。但直到前几天才正式接触了下Google App Engine。这里就简单介绍一下。
Google App  Engine是一个开发、托管网络应用程序的平台，使用Google管理的数据中心。它在2008年4月发布了第一个beta版本。它虽然对免费用户做出了一些限制，但用来满足我们的基本需求还是足够了（Via  维基百科）。
首先，我们要用自己的Google帐号登录https://appengine.google.com/ 。然后选择  Creat an Application(创建一个应用)，首次登陆会被要求验证。要选择国家并输入电话号码，我们选择Other(Not  Listed)就可以，输入手机号码时，别忘了在前面加上+86（eg.+8613800138000）。很快你就会收到验证码了。到时回来确认一下。输入自己应用的网址(***.appspot.com)和名称就可以创建你的应用了。
这样，网络部分的准备工作就做完了。然后动手做本地部分的工作。
首先，下载并安装 Python  2.5.4 ；
其次，下载并安装 Google App  Engine SDK 。
安装过程没什么好说的。如果你想检测安装成功与否，可以进入命令行下运行一下 dev_appserver.py  指令(快捷键Win + R)。
在你成功的安装了Google App Engine所用开发环境之后，那我们开始创建一个小应用吧。和很多语言一样，第一个应用一定是&#8220;Hello  Something&#8221;，我们要做的也是显示&#8220;hello the Google App Engine~&#8221; 的应用。
新建一个目录，将其命名为hello；
然后在hello目录下，新建一个文本文档，输入以下内容，然后将其重命名为 app.yaml。

application:  hello
version:  1
runtime:  python
api_version:  1

handlers:
-  url: [...]]]></description>
			<content:encoded><![CDATA[<p><img width="149" height="115" border="1" align="left" src="http://code.google.com/appengine/images/appengine_lowres.gif" alt="appengine" title="appengine" style="border-width: 0px; display: inline; margin-left: 0px; margin-right: 0px;" />&nbsp;&nbsp;&nbsp;&nbsp; 好吧，我承认我刚刚看过<a href="http://cn.engadget.com/">瘾科技</a>的订阅，所以才起了一个这样的标题。</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp; 以前只是用过由<a href="https://appengine.google.com/">Google App  Engine</a>搭建的服务，像一些代理之类的。但直到前几天才正式接触了下<a href="https://appengine.google.com/">Google App Engine</a>。这里就简单介绍一下。</p>
<p>Google App  Engine是一个开发、托管网络应用程序的平台，使用Google管理的数据中心。它在2008年4月发布了第一个beta版本。它虽然对免费用户做出了<a href="http://zh.wikipedia.org/zh-cn/Google_App_Engine#.E5.85.8D.E8.B4.B9.E7.9A.84.E9.A2.9D.E5.BA.A6">一些限制</a>，但用来满足我们的基本需求还是足够了（Via  <a href="http://zh.wikipedia.org/zh-cn/Google_App_Engine">维基百科</a>）。</p>
<p>首先，我们要用自己的Google帐号登录<a href="https://appengine.google.com/" title="https://appengine.google.com/">https://appengine.google.com/</a> 。然后选择  Creat an Application(创建一个应用)，首次登陆会被要求验证。要选择国家并输入电话号码，我们选择Other(Not  Listed)就可以，输入手机号码时，别忘了在前面加上+86（eg.+8613800138000）。很快你就会收到验证码了。到时回来确认一下。输入自己应用的网址(***.appspot.com)和名称就可以创建你的应用了。</p>
<p>这样，网络部分的准备工作就做完了。然后动手做本地部分的工作。</p>
<p>首先，下载并安装 <a href="http://www.python.org/download/releases/2.5.4/">Python  2.5.4</a> ；</p>
<p>其次，下载并安装 <a href="http://code.google.com/intl/zh-CN/appengine/downloads.html">Google App  Engine SDK</a> 。</p>
<p>安装过程没什么好说的。如果你想检测安装成功与否，可以进入命令行下运行一下 <strong>dev_appserver.py</strong>  指令(快捷键Win + R)。</p>
<p>在你成功的安装了Google App Engine所用开发环境之后，那我们开始创建一个小应用吧。和很多语言一样，第一个应用一定是&ldquo;Hello  Something&rdquo;，我们要做的也是显示&ldquo;hello the Google App Engine~&rdquo; 的应用。</p>
<p>新建一个目录，将其命名为hello；</p>
<p>然后在hello目录下，新建一个文本文档，输入以下内容，然后将其重命名为 <strong>app.yaml</strong>。</p>
<blockquote>
<p><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" />application:  hello<br />
<img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" />version:  1<br />
<img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" />runtime:  python<br />
<img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" />api_version:  1<br />
<img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" /><br />
<img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" />handlers:<br />
<img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" />-  url: /.*<br />
<img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" />&nbsp;  script: hello.py</p>
<p>&nbsp;</p>
</blockquote>
<p>然后在hello目录下，用同样的方法再建立一个名为 <strong>hello.py </strong>的文件，输入以下内容。</p>
<blockquote>
<p><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" />print  &#8216;Content-Type: text/plain&#8217;<br />
<img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" />print  &#8221;<br />
<img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" />print  &#8216;hello the Google App Engine~&#8217;</p>
<p>&nbsp;</p>
</blockquote>
<p>完成以上两个步骤，我们可以测试一下这个应用有没有成功：在命令行输入类似 <strong>dev_appserver.py  d:/app-demo/hello</strong> ，将d:/app-demo/hello 换成自己hello目录所在的路径。</p>
<p>如果成功了，会有一个到 <a href="http://localhost:8080/">http://localhost:8080</a>  进行本地预览的提示。</p>
<p>之后就是上传到google服务器上了。依旧用命令行来执行，路径记得自己换下：</p>
<blockquote>
<p><strong>appcfg.py update d:/app-demo/hello</strong></p>
</blockquote>
<p>&nbsp;</p>
<p>上传完成之后，你赶紧打开你的Google App Engine(***.appspot.com)地址看下，是不是显示了&ldquo;hello the Google  App Engine~ &rdquo;的字样（eg.<a href="http://leqcany.appspot.com/" title="http://leqcany.appspot.com/">http://leqcany.appspot.com/</a>）。</p>
<p>好啦，这样一个简单的Google App Engine应用就完成啦。你可以向更深一层进阶啦。</p>
<p>　　比较有用的第三方应用有：</p>
<p>　　GAppProxy <a href="http://code.google.com/p/gappproxy/">http://code.google.com/p/gappproxy/</a></p>
<p>　　birdnest&nbsp; <a href="http://code.google.com/p/birdnest/">http://code.google.com/p/birdnest/</a>&nbsp;</p>
<p>&nbsp;</p>
<p>PS1: 文中示例参考：<a href="http://blog.csdn.net/nieyong/archive/2008/04/11/2282903.aspx" title="http://blog.csdn.net/nieyong/archive/2008/04/11/2282903.aspx">http://blog.csdn.net/nieyong/archive/2008/04/11/2282903.aspx</a></p>
<p>PS2: Google App Engine 官方教程：<a href="http://code.google.com/appengine/docs/python/gettingstarted/" title="http://code.google.com/appengine/docs/python/gettingstarted/">http://code.google.com/appengine/docs/python/gettingstarted/</a>&nbsp;&nbsp;</p>
<p>&nbsp;</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>&nbsp;</p>
<p>下面附赠一个Google App Engine错误及解决办法：</p>
<blockquote>
<p>Error 409: &#8212; begin server output &#8212;<br />
Another transaction by user coolchyni is already in progress for this app and ma<br />
jor version. That user can undo the transaction with appcfg.py&#8217;s &quot;rollback&quot; comm<br />
and.<br />
&#8212; end server output &#8212;
</p></blockquote>
<p>解决办法：</p>
<blockquote>
<p>命令行输入： appcfg.py rollback 你的目录
</p></blockquote>
<hr />
<p><small>© leplay for <a href="http://leqcany.com">乐趣参与</a>, 2009. |
<a href="http://leqcany.com/2009/10/google-app-engine.html">Permalink</a> |
<a href="http://leqcany.com/2009/10/google-app-engine.html#comments">No comment</a> |

Post tags: <a href="http://leqcany.com/tag/gae" rel="tag">GAE</a>, <a href="http://leqcany.com/tag/google" rel="tag">google</a><br/>
</small></p>]]></content:encoded>
			<wfw:commentRss>http://leqcany.com/2009/10/google-app-engine.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
