gae 入门简介 九月 21st, 2009

 

现在网上已经有好多玩家发布现成的程序,我们可以直接上传使用,但这里会带来一个问题,是我们原本无法想到的。后面会提到。

首先我们需要前期准备:

1、注册GAE
链接:http://appengine.google.com/

注册必须是Gmail用户。

2、登录GAE,新建一个应用(application)
比如我新建的应用名为:yuebinliu

3、下载、安装App Engine SDK
链接:http://code.google.com/intl/zh-CN/appengine/downloads.html

比如我的安装目录为:D:\Program Files\Google\google_appengine

4、下载、安装python 2.5
链接:http://www.python.org/ftp/python/2.5.4/python-2.5.4.msi

为什么是2.5呢?因为目前GAE只支持2.5。

 

下面我们看如何在本地启动调试程序 和 安装调试好的程序。

1、启动本地server调试程序。就拿hello world举个列子(hello world是gg提供的一个测试程序,具体查看官方提供的说明

Start the web server with the following command, giving it the path to the helloworld directory:

google_appengine/dev_appserver.py helloworld/

The web server is now running, listening for requests on port 8080. Test the application by visiting the following URL in your web browser:

2、安装程序。我们这里就用micolog这个比较流行的blog来举列子。

1)把micolog 复制到GAE的安装目录(你可以对micolog目录名改名,比如我就改名为“yuebinliu”),修改app.yaml文件中的第一行,把“application:”后面的“mlog”,改成你在GAE上新建的应用名。比如,我就改成:application:yuebinliu

2)开始-运行-cmd,进入D:\Program Files\Google\google_appengine,输入命令:

appcfg.py update yuebinliu/

然后根据提示输入gmail地址和密码,通过后会上传micolog 博客程序。这时你就可以访问你在GAE上的博客了,访问的地址为:http://应用名.appspot.com, 比如我的就是:http://yuebinliu.appspot.com

 经过上面的方法详细大家都已经搭建好和我一样的平台了。恭喜你。

在安装程序很可能出现有人无法上传 index.yaml文件的问题。

Uploading index definitions.
Error 400: --- begin server output ---
Creating a composite index failed: This index:
entity_type: "Comment"
ancestor: false
Property {
  name: "date"
  direction: 2
}

is not necessary, since single-property indices are built in. Please remove it f
rom your index file and upgrade to the latest version of the SDK, if you haven't
 already.
--- end server output ---
Your app was updated, but there was an error updating your indexes. Please retry
 later with appcfg.py update_indexes.

 这个很多人安装教程里面都没提到,哭~

产生这个问题的原因是未在本地调试程序,当你本地调试的时候程序会自动帮你生成一条规则到index.yaml ,上传程序的时候index 规则也会更新。 你需要做的仅仅是删除index.yaml文件里面的规则,然后调试,再上传index.yaml文件到服务器就可以了。重上传index.yaml命令:

appcfg.py update_indexes yuebinliu/

Tags: gae blog

Posted in gae | Edit | Comments(0)»

Relate Posts:

Tags: gae blog

Posted in gae |

Leave a Reply

7+9