網路科技

Google App Engine (4) : Python, Django

商業,創業,業務,職涯,美食,葡萄酒,閱讀,網路科技。

從 Larry 創業以及商業的經驗,希望以白話的口吻,介紹給大家這個商業的世界。

FB粉專會頻繁地更新 Larry 對於商業、社會、人生的觀察與心得,歡迎大家追蹤互動~

Google Cloud SQL 是 non-relational database, 而 Django 本身是只支援 traditional databases, 所以 Django 要上 GAE 的話, 要注意的是原始 Django framework 不能再用了, 要改用 Django-nonrel 這個專案.
https://github.com/django-nonrel/django

另外要注意的是, 目前不管是 django-nonrel 的 testapp
https://github.com/django-nonrel/django-testapp

還是 Google Cloud Platform 的 django-skeleton
https://github.com/GoogleCloudPlatform/appengine-django-skeleton

都是用 execute_manager 這個 function, 在目前 Django 版本 (1.6) 已經不支援它了. 所以就單純化問題來說, 電腦最好不要安裝新版 Django. 安裝 django-nonrel/testapp 與 Google Cloud Platform/django-skeleton 時下載相依檔案時會下載 django-nonrel 的 1.4 版 (其他相依模組也是 1.4 版).

django-nonrel/testapp 與 Google Cloud Platform/django-skeleton 的差異? django-skeleton 的 app.yaml 有加 comment. 如果不算 comment 或 README 的話, 兩個 project 算是相同. 接著分析一下上述專案的架構, 它包含5個 app
autoload
dbindexer
django
djangoappengine
djangotoolbox

程式進入點 djangoappengine.main.application 位於 djangoappengine/main/__init__.py
application = WSGIHandler()

launch 起來看到的頁面是 /templates/home.html, 依照 Django 的架構, 由 /url.py 所指定. Nice article:
http://blog.wu-boy.com/2009/04/django-web-framework-django-%E5%88%9D%E9%9A%8E%E5%AD%B8%E7%BF%92%E5%BF%83%E5%BE%97/

商業,創業,業務,職涯,美食,葡萄酒,閱讀,網路科技。

從 Larry 創業以及商業的經驗,希望以白話的口吻,介紹給大家這個商業的世界。

FB粉專會頻繁地更新 Larry 對於商業、社會、人生的觀察與心得,歡迎大家追蹤互動~