GoogleAppEngineLauncher で Hello, world! - はじめてのGAE その1

Google App Engine が一般公開され、SDK もバージョンアップした様なので試してみる事にした。

手順

  1. GoogleAppEngineLauncher.app を起動
  2. 新規アプリケーションを作成 File > New Application(cmd + N)
  3. helloworld.py を作成
  4. app.yaml を編集
  5. Web サーバを起動 Control > Run(cmd+R)
  6. Web サーバへアクセス
  7. Hello, world!
1. GoogleAppEngineLauncher.app を起動
  1. Download and Install the SDK for App Engine  |  App Engine Documentation  |  Google Cloud からダウンロードした GoogleAppEngineLauncher-1.1.0.dmg を開く。
  2. GoogleAppEngineLauncher.app をアプリケーションフォルダ等にコピー。
  3. 起動。
2. 新規アプリケーションを作成
  1. File > New Application(cmd + N)
  2. 表示されるダイアログに、アプリケーション名(Application Name)と、保存するディレクトリ(Application Directory)を入力し、[Create]。
    • /Application Directory/Application Name/ 以下に、app.yaml, index.yaml, main.py が自動生成されます。
3. helloworld.py を作成
print 'Content-Type: text/plain'
print ''
print 'Hello, world!'
http://code.google.com/appengine/docs/gettingstarted/helloworld.html
4. app.yaml を編集
  1. 8行目の main.py を helloworld.py に。
application: helloworld
version: 1
runtime: python
api_version: 1

handlers:
- url: .*
  script: helloworld.py
5. Web サーバを起動
  1. Control > Run(cmd+R)
6. Web サーバへアクセス
  1. Control > Browse(cmd+B)
7. Hello, world!
  • 実際は helloworld.py 中の「'」を一つ入力し忘れてエラーが沢山表示された。不注意注意

おわりに

  • GoogleAppEngineLauncher.app はコマンドラインを使わなくてもアプリケーションの作成、管理、起動が GUI で行えるのでお手軽です。
  • これからもっと GAE, Django, Python を学習し、色々と作っていきたい。
  • 簡単にでもメモをとりながらの方が何かと良い。