remote api 使用上的注意事項

法一

要使用google 提供的 remote_api_shell.py 來進行的話...
https://developers.google.com/appengine/articles/remote_api

先行步驟:
a. 切換當前目錄到專案資料夾b. 鍵入 "C:\Program Files (x86)\Google\google_appengine\remote_api_shell.py" -s tagtooxxx.appspot.com
如此便可以進入comment line 狀態

在air 環境上:

注意, 要採取這個用法, 必須先切換目錄到當前的專案, 否則會有db model 找不到的問題(實際上只有資料是remote, 檔案還是用local)
python "C:\Program Files (x86)\Google\google_appengine\remote_api_shell.py" -s fanshop-test.appspot.com
(注意要完全照打或複製貼上, 且不能有段行, 否則會有檔名錯誤)

可用此console 執行python 指令, 不過記得一樣要斷行(按enter, 系統會根據python 語法自動斷行)和縮排(按tab)

接下來會發現要 import 像是db.models 會產生錯誤...
此時則要用 sys.path.append(r'D:\tagtoo dev\new svn - tagtoo new server\src-1')
這樣專案的根目錄才會被加入, 如此要import 東西才不會有module not found 的錯誤
例如: from db.models import * (經過測試, 不能輸入 import db.models)

法二

若用同事寫的 appengine_console.py(在專案的根目錄下
會遇到simplejson module not define 的情況, 這是因為python 環境裡面沒有安裝simplejson module, 可以用python 的easy_install.exe 檔來安裝simplejson 模組, 其路徑為 C:\Python25\Scripts\easy_install.exe 例如要裝simplejson 就(在project 專案目錄下)下指令 C:\Python25\Scripts\easy_install.exe simplejson




完成安裝後, 便可在專案目錄下下指令 appengine_console.py tagtoozouber 就會work 了!

留言

熱門文章