GAE on GO

1. Download the Google App Engine SDK

Link : GAE SDK

目標安裝在MAC

Go requires Python 2.7.x; don’t use a higher version. (The Go SDK uses tools from the App Engine Python SDK, so Python is required.) Make sure Python 2.7 is installed on your machine using the following command:

/usr/bin/env python -V

先使用/usr/bin/env python -V確認版本在2.7.x

然後分別在$HOME/.profile$HOME/.bashrc加入export PATH=/path/to/go_appengine:$PATH

範例:

我的GO GAE放在/Applications/go_appengine/

因此要填入的是export PATH=/Applications/go_appengine:$PATH

2. GAE SDK

goapp serve, for running a local development server

goapp deploy, for uploading your app to App Engine

3. Google 後端Console

4. 部署

本地部署

goapp serve

預設是在http://localhost:8080/

遠端部署

先到Google Develop Console新增一個專案

分別填上專案名稱專案ID,假設是Test和a-b-c

接著回去設定app.yaml,把專案ID設定進去

app.yaml
1
2
application: a-b-c
...

接著,可以部署你的程式了,使用goapp deploy

部屬的網址預設是放在http://your_app_id.appspot.com/

所以就是在http://a-b-c.appspot.com/

Final. 最後一個最重要的步驟

收工