Your SlideShare is downloading. ×
0
國民雲端架構 Django + GAE
國民雲端架構 Django + GAE
國民雲端架構 Django + GAE
國民雲端架構 Django + GAE
國民雲端架構 Django + GAE
國民雲端架構 Django + GAE
國民雲端架構 Django + GAE
國民雲端架構 Django + GAE
國民雲端架構 Django + GAE
國民雲端架構 Django + GAE
國民雲端架構 Django + GAE
國民雲端架構 Django + GAE
國民雲端架構 Django + GAE
國民雲端架構 Django + GAE
國民雲端架構 Django + GAE
國民雲端架構 Django + GAE
國民雲端架構 Django + GAE
國民雲端架構 Django + GAE
國民雲端架構 Django + GAE
國民雲端架構 Django + GAE
國民雲端架構 Django + GAE
國民雲端架構 Django + GAE
國民雲端架構 Django + GAE
國民雲端架構 Django + GAE
國民雲端架構 Django + GAE
國民雲端架構 Django + GAE
國民雲端架構 Django + GAE
國民雲端架構 Django + GAE
國民雲端架構 Django + GAE
國民雲端架構 Django + GAE
國民雲端架構 Django + GAE
國民雲端架構 Django + GAE
國民雲端架構 Django + GAE
國民雲端架構 Django + GAE
國民雲端架構 Django + GAE
國民雲端架構 Django + GAE
國民雲端架構 Django + GAE
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

國民雲端架構 Django + GAE

2,675

Published on

就要應邀到GTug分享 djangoappengine 了! …

就要應邀到GTug分享 djangoappengine 了!

另外,我有準備了一個範例專案,請到這邊下載:
http://www.2shared.com/file/c6Y8xbPv/gtugproj.html

好險有科技:
http://techblog.insureme.com.tw/

Published in: Technology
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,675
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
32
Comments
0
Likes
4
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Transcript

    • 1. Django + GAE@wingchen83
    • 2. WINGCHEN•• java compiler (antlr parser generator)• python•• GAE djangoappengine
    • 3. WHY DJANGO www.djangoproject.com• / / web framework (me!)• ruby me!• python (me!)• (me!)
    • 4. INSTALLATION docs.djangoproject.com/en/1.3/intro/install/• python• download django official release• (linux: sudo) python setup.py install
    • 5. FIRST DJANGO APP: A BLOG!! docs.djangoproject.com/en/1.3/intro/tutorial01• django-admin.py startproject gtugproj• Tryit: python manage.py runserver (8080)
    • 6. DB SETUP docs.djangoproject.com/en/1.3/intro/tutorial01• Let’s use sqlite! DATABASES = { default: { ENGINE: django.db.backends.sqlite3, NAME: gtugproj.sqlite, } }• Updateit: python manage.py syncdb• Voila, the project is UP!
    • 7. COMMENCE THE BLOG APP• python manage.py startapp blog
    • 8. DJANGO MVC• Diagram form: metodologiasdesistemas.blogspot.com
    • 9. DJANGO MVC urls.py/ modles.py views.py views.py/ templates• Diagram form: metodologiasdesistemas.blogspot.com
    • 10. THE BLOG MODEL docs.djangoproject.com/en/dev/topics/db/models/from django.db import modelsfrom datetime import datetimeclass Blog(models.Model): blog_id = models.AutoField(primary_key=True) title = models.CharField(max_length=50) content = models.TextField() pub_date = models.DateTimeField(default=datetime.now)
    • 11. THE BLOG VIEW docs.djangoproject.com/en/dev/topics/db/queries• Show Blogs:def blog_view(request): blogs = Blog.objects.all() output = output += <FORM action="blog_add" method="post"> output += <INPUT name="title" type="text" id="title"/><BR> output += <textarea rows="10" cols="20" id="content" name="content"></textarea><BR> output += <INPUT type="submit" id="submit" value="Go"/><BR> output += </FORM><br> for blog in blogs: output += title: + blog.title + <br> output += pub_date: + str(blog.pub_date) + <br> output += content: + blog.content + <br><br> return HttpResponse(output, mimetype=text/html)
    • 12. THE BLOG VIEW docs.djangoproject.com/en/dev/topics/db/queries• New Blog:@csrf_exemptdef blog_add(request): title = request.REQUEST.get(title, default title) content = request.REQUEST.get(content, default content) Blog(title=title, content=content).save() return redirect(/blog/)
    • 13. THE BLOG CONTROLLER• gtugproj/urls.py (^blog/, include(blog.urls)),• gtugproj/blog/urls.py (^blog_add, blog_add), (, blog_view),
    • 14. PUT IT IN SETTINGS.PY INSTALLED_APPS = ( django.contrib.auth, django.contrib.contenttypes, django.contrib.sessions, django.contrib.sites, blog )• Then: python manage.py syncdb
    • 15. DJANGOAPPENGINE ...• Django Nonrel Django NoSQL Database ORM
    • 16. DJANGO NONREL ?• Developers Model• Django ORM• SQL• Django-dbindexer• No-Sql DB Calls
    • 17. DJANGO NONREL?• non-relational DBs• PO SQL DBs• / Denormalization• querie• (GAE, etc.)
    • 18. DJANGO NONREL• GAE djangoappengine• MongoDB MongoDB backend ( LittleQ)
    • 19. DJANGO NONREL• ElasticSearch• Cassandra
    • 20. DJANGOAPPENGINE www.allbuttonspressed.com/projects/djangoappengin• Django App Engine : • DB • Email• Django Nonrel
    • 21. BLOG APP GAE• django-nonrel/django => gtugproj/django• djangotoolbox/djangotoolbox => gtugproj/djangotoolbox• django-autoload/autoload => gtugproj/autoload• django-dbindexer/dbindexer => gtugproj/dbindexer• djangoappengine => gtugproj/djangoappengine
    • 22. • gtugproj/django• gtugproj/djangotoolbox• gtugproj/autoload• gtugproj/dbindexer• gtugproj/djangoappengine
    • 23. COPY SAMPLE• app.yaml• cron.yaml• index.yaml• indexes.py• manage.py (overwrite)
    • 24. SETTINGS.PY• [please follow up]
    • 25. TRAIL RUN• python manage.py runserver
    • 26. DEPLOY TO GAE• GAE APP• app.yaml• python manage.py deploy
    • 27. DJANGOAPPENGINE• JOIN !! ( , ,JOIN )• many-to-many• Aggregates• transactions• GAE run_in_transaction()
    • 28. DEPENDENCIES• source code gtugproj• 3000 • zip-packages
    • 29. CACHE• Django memcache module API• GAE – memcache backend
    • 30. CACHE•from django.core.cache import cacheinsureme_blog_rss_url = http://blog.insureme.com.tw/feeds/posts/defaultdef get_blog_rss_feeds(): feeds = cache.get(blog_rss_feeds) if feeds == None: refresh_cache_blog_rss_feeds() return cache.get(blog_rss_feeds) return feeds
    • 31. CACHE•insureme_blog_rss_url = http://blog.insureme.com.tw/feeds/posts/defaultdef get_blog_rss_feeds(): refresh_cache_blog_rss_feeds() return cache.get(blog_rss_feeds)
    • 32. CACHE• ab- 10 connections 10- 2000 requests in total 2000 request
    • 33. CACHE Cache CacheConcurrency Level: 10 Concurrency Level: 10Time taken for tests: 590.238 seconds Time taken for tests: 237.262 secondsComplete requests: 2000 Complete requests: 2000Failed requests: 1 Failed requests: 0Write errors: 0 Write errors: 0Total transferred: 1619817 bytes Total transferred: 1620000 bytesHTML transferred: 1313809 bytes HTML transferred: 1314000 bytesRequests per second: 3.39 [#/sec] (mean) Requests per second: 8.43 [#/sec] (mean)Time per request: 2951.190 [ms] (mean) Time per request: 1186.308 [ms] (mean)Time per request: 295.119 [ms] (mean, Time per request: 118.631 [ms] (mean,across all concurrent requests) across all concurrent requests)Transfer rate: 2.68 [Kbytes/sec] Transfer rate: 6.67 [Kbytes/sec]received received
    • 34. / www.allbuttonspressed.com/projects/django-filetransfers• django-filetransfers • “filetransfers” • “filetransfers” INSTALLED_APPS
    • 35. TASKING bitbucket.org/wkornewald/django-defer••
    • 36. Q&A?• url: http://techblog.insureme.com.tw• twitter: wingchen83
    • 37. THANK YOU!!• url: http://techblog.insureme.com.tw• twitter: wingchen83

    ×