こちらに書くのはえらく久しぶり。
さて、google app engine for python をLinux上で構築する際のメモ。
まずはgoogle配布のチュートリアルを一通り目を通す
http://code.google.com/intl/ja/appengine/
http://code.google.com/intl/ja/appengine/downloads.html
http://code.google.com/intl/ja/appengine/docs/whatisgoogleappengine.html
http://code.google.com/intl/ja/appengine/docs/python/runtime.html
http://code.google.com/intl/ja/appengine/docs/python/gettingstarted/
【開発環境の構築】
・pythonのインストール
利用しているサーバにpythonは入っているが、バージョンが合わないので、追加インストール
ここで気をつけなければいけないのは、python2.5でないといけないということ。最初2.6をインストールしたのだが、google app engineにはねられてしまった。
・easy_installのインストール
easy_installはpython版のPECLやyumに相当するもの
[参考URL] http://morchin.sakura.ne.jp/effective_python/easy_install.html
・pysqliteのインストール
google apps engineではsqliteを使うので、python sqliteモジュールをインストール
easy_install pysqlite
※src/connection.h:33:21: sqlite3.h: No such file or directory
のエラーが出る場合はおそらくsqlite-devが入っていない。yum等でいれること。
・PILのインストール
easy_install PIL
・SSLモジュールのインストール
2010-10-22 13:32:57,608 WARNING appengine_rpc.py:405 ssl module not found.
【最初のアプリケーション】
http://code.google.com/intl/ja/appengine/docs/python/gettingstarted/helloworld.html
をみながら最初のアプリケーションを作成してみる。
起動に成功すれば、一番下にあるように8080ポートでアプリケーションが立ち上がっているはず
※apacheが起動していない場合は80ポートで立ち上がるかもしれない。
./dev_appserver.py apps/helloworld/
INFO 2010-10-22 03:18:21,789 py_zipimport.py:108] zipimporter('/usr/local/lib/python2.5/site-packages/pysqlite-2.6.0-py2.5-linux-x86_64.egg', 'pysqlite2/')
INFO 2010-10-22 03:18:21,849 appengine_rpc.py:153] Server: appengine.google.com
Allow dev_appserver to check for updates on startup? (Y/n):
dev_appserver will check for updates on startup. To change this setting, edit /home/futaroh/.appcfg_nag
INFO 2010-10-22 03:18:40,601 appcfg.py:414] Checking for updates to the SDK.
INFO 2010-10-22 03:18:46,476 appcfg.py:428] The SDK is up to date.
WARNING 2010-10-22 03:18:46,476 datastore_file_stub.py:818] Could not read datastore data from /tmp/dev_appserver.datastore
WARNING 2010-10-22 03:18:46,482 dev_appserver.py:3663] Could not initialize images API; you are likely missing the Python "PIL" module. ImportError: No module named _imaging
INFO 2010-10-22 03:18:46,486 dev_appserver_main.py:443] Running application helloworld on port 8080: http://localhost:8080
telnetでローカルホストを叩くと、予想通りの結果が返ってくるはず。
telnet localhost 8080
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET /
Content-type: texxt/plain
Cache-Control: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Content-Length: 13
Hello, world
Connection closed by foreign host.
【googleへの登録】(2010.10.22)
まずはgoogleのサイト上で、app名を登録します。
https://appengine.google.com/start/createapp
その後、アプリケーション名を登録する
ここで登録したapplication nameをあとでyamlに書き込む必要がある。
続いて、登録したappに実体をアップロードします。
http://code.google.com/intl/ja/appengine/docs/python/tools/uploadinganapp.html
【フレームワークの選定】
さて、開発にあたって、どのフレームワークを使うかを考えねば。
http://ja.wikipedia.org/wiki/Django
http://ja.wikipedia.org/wiki/CherryPy
http://ja.wikipedia.org/wiki/Pylons
http://webpy.org/tutorial2.ja
【宿題】
python sslのインストールができない。
appのアップロードができない。
