2008年4月11日金曜日

Google App Engine 入門2



Docs > Getting Started >


1. Hello, World!
2 Using the webapp Framework
3 Using the Users Service
4 Handling Forms With webapp
 ここまではチュートリアルのコードをそのまま利用できます。
5 Using the Datastore
 ここでは 4 のソースに追加するようになります。
 SQL を発行して、データベースにアクセスしているようですが、特に自分でデータベースを作成したり、テーブルを作成したりする必要なく、ローカルで稼動しました。
 一時ファイルをデータベースとして作成しているようです。

C:\google>dev_appserver.py --clear_datastore helloworld/
INFO 2008-04-11 16:43:28,375 appcfg.py] Checking for updates to the SDK.
INFO 2008-04-11 16:43:28,780 appcfg.py] The SDK is up to date.
INFO 2008-04-11 16:43:28,780 dev_appserver.py] Attempting to remove file at
c:\docume~1\user\locals~1\temp\dev_appserver.datastore
6. Using Templates
 5 のスクリプトを修正
 Django が導入され、SQL がなくなる。テンプレートの詳細は Django のサイトへ。



7. Using Static Files
 不具合注意

 windows 環境では bug 対応が必要
app.yaml と \google\appengine\tools\dev_appserver.py を修正する。
see -> http://d.hatena.ne.jp/Aoba/20080410/1207842114
 上記も含めいろいろやったが
INFO 2008-04-11 16:01:44,328 dev_appserver.py] "GET /stylesheets/main.css HTTP/1.1" 404 -
が止まらず。 

link type="text/css" rel="stylesheet" href="c:/google/helloworld/stylesheets/main.css"
のように絶対パスで書くとエラーは止まるが、cssは適用されていない様子。
dev_appserver.py は修正した状態。
結局、このファイルは元に戻して、 css ファイルは分けるのをやめた。
- index.html 内に当面、記述

<head>
<style type="text/css">
body {
font-family: Verdana, Helvetica, sans-serif;
background-color: #DDDDDD;
}
</style>
</head>

追記:  以下のような対策で利用可能となりました。 app.yaml の変更

- url: /css/(.*\.css)
static_files: css/\1
upload: css/(.*\.css)


やはり javascript などの利用を考えた場合、別ファイルにできないのはつらい。

8. Uploading Your Application
 アカウントが必要


その他のエラー対応

・ helloworld.py の改行が正しくなく、2行が1行になっているときに以下のようなエラーとなります。

Python 2.5.2: C:\Python25\python.exeFri Apr 11 13:01:06 2008
A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred.
C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.p in _HandleRequest(self=)
2243 infile,
2244 outfile,
2245 base_env_dict=env_dict)
2246 finally:
2247 self.module_manager.UpdateModuleFileModificationTimes()
base_env_dict undefined, env_dict = {'REMOTE_ADDR': '127.0.0.1', 'REQUEST_METHOD': 'GET', 'SERVER_NAME': 'localhost', 'SERVER_PORT': '8080', 'SERVER_PROTOCOL': 'HTTP/1.0', 'SERVER_SOFTWARE': 'Development/1.0'}


・ main.css ファイルの文字コードが sjis になっていた時のエラー

ERROR 2008-04-11 14:59:53,453 __init__.py] Traceback (most recent call last):
File "C:\Program Files\Google\google_appengine\google\appengine\ext\webapp\__init__.py", line 486, in __call__ handler.post(*groups) File "C:\Documents and Settings\kt\My Documents\google\helloworld\helloworld.py", line 39, in post greeting.put() File "C:\Program Files\Google\google_appengine\google\appengine\ext\db\__init__.py", line 602, in put self._save_to_entity() File "C:\Program Files\Google\google_appengine\google\appengine\ext\db\__init__.py", line 621, in _save_to_entity self._store_to_entity(self._entity) File "C:\Program Files\Google\google_appengine\google\appengine\ext\db\__init__.py", line 587, in _store_to_entity entity[prop.name] = datastore_value File "C:\Program Files\Google\google_appengine\google\appengine\api\datastore.py", line 341, in __setitem__ datastore_types.ToPropertyPb(name, value) File "C:\Program Files\Google\google_appengine\google\appengine\api\datastore_types.py", line 976, in ToPropertyPb pbvalue.mutable_uservalue().set_email(v.email().encode('utf-8'))UnicodeDecodeError: 'ascii' codec can't decode byte 0x82 in position 3: ordinalnot in range(128)
----------------------------------------------------



Unityでドアの開閉はAnimatorそれともiTween?

Mac Mini M2 の Unity で Sketchup のデータを復元したつづき。 以前、苦労して作成したドアの開閉が動作しないので修復する。 どうやって動かしていたのか、また忘れそうなので記録しておく。             Animator 左右のドア PlaneL,...