Hello, world! | Google App Engine
http://code.google.com/intl/ja/appengine/docs/python/gettingstarted/helloworld.html
こちらは、このままなので特に
以下のようにディレクトリ作成。
C:\apps\helloworld
その中に
簡単なリクエスト ハンドラの作成
helloworld.py
print 'Content-Type: text/plain' print '' print 'Hello, world!'
設定ファイルの作成
app.yaml
application: helloworld version: 1 runtime: python api_version: 1 handlers: - url: /.* script: helloworld.py
の2ファイルを作成。
アプリケーションのテスト
コマンドプロンプトから、ここだけ、pathの設定をしていないので、全部フルパスで書くとこんな感じです。
c:\>"Program Files\Python27\python.exe" "C:\Program Files\Google\google_appengine\dev_appserver.py" C:\apps\helloworld INFO 2011-05-03 07:20:57,961 appengine_rpc.py:158] Server: appengine.google.com INFO 2011-05-03 07:20:57,970 appcfg.py:437] Checking for updates to the SDK. INFO 2011-05-03 07:21:10,408 appcfg.py:454] The SDK is up to date. WARNING 2011-05-03 07:21:10,410 datastore_file_stub.py:655] Could not read data store data from c:\users\junichi\appdata\local\temp\dev_appserver.datastore INFO 2011-05-03 07:21:10,420 rdbms_sqlite.py:58] Connecting to SQLite databa se '' with file 'c:\\users\\junichi\\appdata\\local\\temp\\dev_appserver.rdbms' WARNING 2011-05-03 07:21:10,443 dev_appserver.py:4394] Could not initialize ima ges API; you are likely missing the Python "PIL" module. ImportError: No module named _imaging INFO 2011-05-03 07:21:10,456 dev_appserver_main.py:543] Running application helloworld on port 8080: http://localhost:8080 INFO 2011-05-03 07:21:18,489 dev_appserver.py:3951] "GET / HTTP/1.1" 200 - INFO 2011-05-03 07:21:18,753 dev_appserver.py:3951] "GET /favicon.ico HTTP/1 .1" 200 -
以前利用していたものが残っているのでwarningが出ていますがそのままで。
ブラウザから
http://localhost:8080/
で
Hello, world!
が表示されます!
helloworld.pyのhello world部を変えて更新するとちゃんと更新されます。
Google App Engine Launcher
開発環境の実行からデプロイまで出来ます。