目的是開發出一個如下圖的網站:

這只要使用預設的範本就可以產生,請看以下說明...
一、建立Google App Engine 專案


以及選擇2.5的 Python 版本(Google App Engine 目前只支援到2.5版)

若還沒安裝Google App Engine 的SDK ,請到這裡安裝(Windows 版下載)
安裝完成後瀏覽到appengine 目錄,按下Next

最後填入你的 application ID 及專案的範本
- ID是在Google 上申請的應用程式ID,例如ID為practice1122,則App Engine 的網址為 http://practice1122.appspot.com/
- 範本在這裡使用「Hello World」(建議使用「Hello WebApp World」試試看,會比較知道python 這程式在幹麻)
二、執行專案

建立好專案,我們展開practice1122專案的src目錄,可以發現成是自動產生了兩個檔案:
- app.yaml:設定網站目錄與程式碼對應的參考檔
- helloworld.py:你的第一個Python程式

我們可以在src目錄上按右鍵,選擇Run As > PyDev: Google App Run
如此系統會幫我們在 http://127.0.0.1:8080/ 建立一個暫時的測試網站

在網址列輸入http://127.0.0.1:8080/可以預覽剛剛Python 專案的畫面
三、將程式部屬到Google App Engine

若要將應用程式部署至Google App Engine 上,一樣在專案的src 目錄上按下右鍵,選擇PyDev: Google App Engine > Upload

請將Commend to execu 的--secure去除,再按下Run
接著,他會要你輸入你在Google申請的帳號(E-Mail)
請在下面Send to Prompt 中輸入您的帳號(例如:funtion1122@gmail.com),按下Send
然後一樣在Send to Prompt 輸入您的密碼,再按下Send
如此,就可以在你的Google App Engine 中看到剛剛的應用程式囉!
在此,感謝Ericsk 的教學文章,讓我有機會站在巨人肩膀上做補充啊XD
上一篇:Python IDE(開發工具) 的選擇建議→Eclipse
下一篇:待續...
讀者回應 ( 1 意見 )
訂閱張貼留言 (Atom)
Thanks a lot! Very useful tutorial.
張貼留言
如果沒有帳戶,建議使用「名稱/網址」留言喔^^