SlideShare a Scribd company logo
1 of 37
Download to read offline
Django + GAE
@wingchen83
WINGCHEN

•


•   java            compiler (antlr parser generator)

•          python

•


•    GAE                   djangoappengine
WHY DJANGO
       www.djangoproject.com

•   / /              web framework (me!)

•     ruby         me!

•   python (me!)

•                  (me!)
INSTALLATION
         docs.djangoproject.com/en/1.3/intro/install/



•       python

• download   django official release

• (linux: sudo)   python setup.py install
FIRST DJANGO APP: A BLOG!!
        docs.djangoproject.com/en/1.3/intro/tutorial01


• django-admin.py   startproject gtugproj



• Tryit:
 python manage.py runserver (8080)
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!
COMMENCE THE BLOG APP



• python   manage.py startapp blog
DJANGO MVC




• Diagram   form: metodologiasdesistemas.blogspot.com
DJANGO MVC


                          urls.py/          modles.py
                          views.py


                                 views.py/
                                 templates
• Diagram   form: metodologiasdesistemas.blogspot.com
THE BLOG MODEL
   docs.djangoproject.com/en/dev/topics/db/models/

from django.db import models
from datetime import datetime

class 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)
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')
THE BLOG VIEW
    docs.djangoproject.com/en/dev/topics/db/queries

• New   Blog:

@csrf_exempt
def 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/')
THE BLOG CONTROLLER

• gtugproj/urls.py

       ('^blog/', include('blog.urls')),
• gtugproj/blog/urls.py


       ('^blog_add', blog_add),
       ('', blog_view),
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
DJANGOAPPENGINE            ...


• Django   Nonrel
               Django
      NoSQL Database    ORM
DJANGO NONREL         ?
• Developers      Model

• Django   ORM
• SQL

• Django-dbindexer

• No-Sql   DB Calls
DJANGO NONREL?

•            non-relational DBs

•       PO   SQL DBs

•   /             Denormalization

•        querie

•                       (GAE, etc.)
DJANGO NONREL


• GAE
     djangoappengine

• MongoDB
     MongoDB backend
 (                     LittleQ)
DJANGO NONREL



• ElasticSearch

• Cassandra
DJANGOAPPENGINE
     www.allbuttonspressed.com/projects/djangoappengin

•          Django App Engine     :

    • DB

    • Email

•              Django Nonrel
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
• gtugproj/django

• gtugproj/djangotoolbox

• gtugproj/autoload

• gtugproj/dbindexer

• gtugproj/djangoappengine
COPY SAMPLE

• app.yaml

• cron.yaml

• index.yaml

• indexes.py

• manage.py    (overwrite)
SETTINGS.PY



• [please   follow up]
TRAIL RUN



• python   manage.py runserver
DEPLOY TO GAE

•        GAE APP

•        app.yaml



•

    python manage.py deploy
DJANGOAPPENGINE

•       JOIN !! (       ,         ,JOIN   )

•   many-to-many

•   Aggregates

•   transactions

•       GAE        run_in_transaction()
DEPENDENCIES


•       source code     gtugproj

•                      3000

    •   zip-packages
CACHE


•   Django memcache module API

•    GAE       – memcache backend
CACHE

•
from django.core.cache import cache

insureme_blog_rss_url = 'http://blog.insureme.com.tw/feeds/posts/default'

def 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
CACHE

•



insureme_blog_rss_url = 'http://blog.insureme.com.tw/feeds/posts/default'

def get_blog_rss_feeds():
   refresh_cache_blog_rss_feeds()
   return cache.get('blog_rss_feeds')
CACHE

•   ab



- 10 connections    10
- 2000 requests in total     2000   request
CACHE
    Cache                                       Cache

Concurrency Level:      10                    Concurrency Level:      10
Time taken for tests: 590.238 seconds         Time taken for tests: 237.262 seconds
Complete requests:      2000                  Complete requests:      2000
Failed requests:     1                        Failed requests:     0
Write errors:        0                        Write errors:        0
Total transferred:    1619817 bytes           Total transferred:    1620000 bytes
HTML transferred:       1313809 bytes         HTML transferred:       1314000 bytes
Requests 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
/
    www.allbuttonspressed.com/projects/django-filetransfers



•          django-filetransfers

    •     “filetransfers”

    •     “filetransfers”   INSTALLED_APPS
TASKING
    bitbucket.org/wkornewald/django-defer




•


•
Q&A?



• url: http://techblog.insureme.com.tw

• twitter: wingchen83
THANK YOU!!



• url: http://techblog.insureme.com.tw

• twitter: wingchen83

More Related Content

What's hot

Refresh Austin - Intro to Dexy
Refresh Austin - Intro to DexyRefresh Austin - Intro to Dexy
Refresh Austin - Intro to Dexyananelson
 
WordCamp Ann Arbor 2015 Introduction to Backbone + WP REST API
WordCamp Ann Arbor 2015 Introduction to Backbone + WP REST APIWordCamp Ann Arbor 2015 Introduction to Backbone + WP REST API
WordCamp Ann Arbor 2015 Introduction to Backbone + WP REST APIBrian Hogg
 
Hybrid Web Applications
Hybrid Web ApplicationsHybrid Web Applications
Hybrid Web ApplicationsJames Da Costa
 
Building an API with Django and Django REST Framework
Building an API with Django and Django REST FrameworkBuilding an API with Django and Django REST Framework
Building an API with Django and Django REST FrameworkChristopher Foresman
 
Frontend JS workflow - Gulp 4 and the like
Frontend JS workflow - Gulp 4 and the likeFrontend JS workflow - Gulp 4 and the like
Frontend JS workflow - Gulp 4 and the likeDamien Seguin
 
PDXPortland - Dockerize Django
PDXPortland - Dockerize DjangoPDXPortland - Dockerize Django
PDXPortland - Dockerize DjangoHannes Hapke
 
Making the most of your Test Suite
Making the most of your Test SuiteMaking the most of your Test Suite
Making the most of your Test Suiteericholscher
 
Writing Software not Code with Cucumber
Writing Software not Code with CucumberWriting Software not Code with Cucumber
Writing Software not Code with CucumberBen Mabey
 
Create responsive websites with Django, REST and AngularJS
Create responsive websites with Django, REST and AngularJSCreate responsive websites with Django, REST and AngularJS
Create responsive websites with Django, REST and AngularJSHannes Hapke
 
Making Django and NoSQL Play Nice
Making Django and NoSQL Play NiceMaking Django and NoSQL Play Nice
Making Django and NoSQL Play NiceAlex Gaynor
 
Getting Started with WP-CLI, a tool to automate your life
Getting Started with WP-CLI, a tool to automate your lifeGetting Started with WP-CLI, a tool to automate your life
Getting Started with WP-CLI, a tool to automate your lifeAJ Morris
 
Scalable Django Architecture
Scalable Django ArchitectureScalable Django Architecture
Scalable Django ArchitectureRami Sayar
 
Cool like a Frontend Developer: Grunt, RequireJS, Bower and other Tools
Cool like a Frontend Developer: Grunt, RequireJS, Bower and other ToolsCool like a Frontend Developer: Grunt, RequireJS, Bower and other Tools
Cool like a Frontend Developer: Grunt, RequireJS, Bower and other ToolsRyan Weaver
 
Reliable Python REST API (by Volodymyr Hotsyk) - Web Back-End Tech Hangout - ...
Reliable Python REST API (by Volodymyr Hotsyk) - Web Back-End Tech Hangout - ...Reliable Python REST API (by Volodymyr Hotsyk) - Web Back-End Tech Hangout - ...
Reliable Python REST API (by Volodymyr Hotsyk) - Web Back-End Tech Hangout - ...Innovecs
 
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and JasmineSingle Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and JasminePaulo Ragonha
 
Automating your workflow with Gulp.js
Automating your workflow with Gulp.jsAutomating your workflow with Gulp.js
Automating your workflow with Gulp.jsBo-Yi Wu
 
You Don't Know Query - WordCamp Portland 2011
You Don't Know Query - WordCamp Portland 2011You Don't Know Query - WordCamp Portland 2011
You Don't Know Query - WordCamp Portland 2011andrewnacin
 

What's hot (20)

Refresh Austin - Intro to Dexy
Refresh Austin - Intro to DexyRefresh Austin - Intro to Dexy
Refresh Austin - Intro to Dexy
 
WordCamp Ann Arbor 2015 Introduction to Backbone + WP REST API
WordCamp Ann Arbor 2015 Introduction to Backbone + WP REST APIWordCamp Ann Arbor 2015 Introduction to Backbone + WP REST API
WordCamp Ann Arbor 2015 Introduction to Backbone + WP REST API
 
Hybrid Web Applications
Hybrid Web ApplicationsHybrid Web Applications
Hybrid Web Applications
 
Building an API with Django and Django REST Framework
Building an API with Django and Django REST FrameworkBuilding an API with Django and Django REST Framework
Building an API with Django and Django REST Framework
 
Frontend JS workflow - Gulp 4 and the like
Frontend JS workflow - Gulp 4 and the likeFrontend JS workflow - Gulp 4 and the like
Frontend JS workflow - Gulp 4 and the like
 
PDXPortland - Dockerize Django
PDXPortland - Dockerize DjangoPDXPortland - Dockerize Django
PDXPortland - Dockerize Django
 
Making the most of your Test Suite
Making the most of your Test SuiteMaking the most of your Test Suite
Making the most of your Test Suite
 
Writing Software not Code with Cucumber
Writing Software not Code with CucumberWriting Software not Code with Cucumber
Writing Software not Code with Cucumber
 
Create responsive websites with Django, REST and AngularJS
Create responsive websites with Django, REST and AngularJSCreate responsive websites with Django, REST and AngularJS
Create responsive websites with Django, REST and AngularJS
 
Making Django and NoSQL Play Nice
Making Django and NoSQL Play NiceMaking Django and NoSQL Play Nice
Making Django and NoSQL Play Nice
 
Getting Started with WP-CLI, a tool to automate your life
Getting Started with WP-CLI, a tool to automate your lifeGetting Started with WP-CLI, a tool to automate your life
Getting Started with WP-CLI, a tool to automate your life
 
Scalable Django Architecture
Scalable Django ArchitectureScalable Django Architecture
Scalable Django Architecture
 
Cool like a Frontend Developer: Grunt, RequireJS, Bower and other Tools
Cool like a Frontend Developer: Grunt, RequireJS, Bower and other ToolsCool like a Frontend Developer: Grunt, RequireJS, Bower and other Tools
Cool like a Frontend Developer: Grunt, RequireJS, Bower and other Tools
 
Mojolicious
MojoliciousMojolicious
Mojolicious
 
Plack - LPW 2009
Plack - LPW 2009Plack - LPW 2009
Plack - LPW 2009
 
Tatsumaki
TatsumakiTatsumaki
Tatsumaki
 
Reliable Python REST API (by Volodymyr Hotsyk) - Web Back-End Tech Hangout - ...
Reliable Python REST API (by Volodymyr Hotsyk) - Web Back-End Tech Hangout - ...Reliable Python REST API (by Volodymyr Hotsyk) - Web Back-End Tech Hangout - ...
Reliable Python REST API (by Volodymyr Hotsyk) - Web Back-End Tech Hangout - ...
 
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and JasmineSingle Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
 
Automating your workflow with Gulp.js
Automating your workflow with Gulp.jsAutomating your workflow with Gulp.js
Automating your workflow with Gulp.js
 
You Don't Know Query - WordCamp Portland 2011
You Don't Know Query - WordCamp Portland 2011You Don't Know Query - WordCamp Portland 2011
You Don't Know Query - WordCamp Portland 2011
 

Similar to 國民雲端架構 Django + GAE

Django Overview
Django OverviewDjango Overview
Django OverviewBrian Tol
 
Introduction Django
Introduction DjangoIntroduction Django
Introduction DjangoWade Austin
 
Gae Meets Django
Gae Meets DjangoGae Meets Django
Gae Meets Djangofool2nd
 
GDG Addis - An Introduction to Django and App Engine
GDG Addis - An Introduction to Django and App EngineGDG Addis - An Introduction to Django and App Engine
GDG Addis - An Introduction to Django and App EngineYared Ayalew
 
PyCon AU 2012 - Debugging Live Python Web Applications
PyCon AU 2012 - Debugging Live Python Web ApplicationsPyCon AU 2012 - Debugging Live Python Web Applications
PyCon AU 2012 - Debugging Live Python Web ApplicationsGraham Dumpleton
 
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)Doris Chen
 
gDayX 2013 - Advanced AngularJS - Nicolas Embleton
gDayX 2013 - Advanced AngularJS - Nicolas EmbletongDayX 2013 - Advanced AngularJS - Nicolas Embleton
gDayX 2013 - Advanced AngularJS - Nicolas EmbletonGeorge Nguyen
 
DjangoCon 2010 Scaling Disqus
DjangoCon 2010 Scaling DisqusDjangoCon 2010 Scaling Disqus
DjangoCon 2010 Scaling Disquszeeg
 
Python & Django TTT
Python & Django TTTPython & Django TTT
Python & Django TTTkevinvw
 
Behind the curtain - How Django handles a request
Behind the curtain - How Django handles a requestBehind the curtain - How Django handles a request
Behind the curtain - How Django handles a requestDaniel Hepper
 
Untangling - fall2017 - week 9
Untangling - fall2017 - week 9Untangling - fall2017 - week 9
Untangling - fall2017 - week 9Derek Jacoby
 
Django apps and ORM Beyond the basics [Meetup hosted by Prodeers.com]
Django apps and ORM Beyond the basics [Meetup hosted by Prodeers.com]Django apps and ORM Beyond the basics [Meetup hosted by Prodeers.com]
Django apps and ORM Beyond the basics [Meetup hosted by Prodeers.com]Udit Gangwani
 
TurboGears2 Pluggable Applications
TurboGears2 Pluggable ApplicationsTurboGears2 Pluggable Applications
TurboGears2 Pluggable ApplicationsAlessandro Molina
 

Similar to 國民雲端架構 Django + GAE (20)

Django Overview
Django OverviewDjango Overview
Django Overview
 
Introduction to Django
Introduction to DjangoIntroduction to Django
Introduction to Django
 
Introduction Django
Introduction DjangoIntroduction Django
Introduction Django
 
Gae Meets Django
Gae Meets DjangoGae Meets Django
Gae Meets Django
 
Django Girls Tutorial
Django Girls TutorialDjango Girls Tutorial
Django Girls Tutorial
 
GDG Addis - An Introduction to Django and App Engine
GDG Addis - An Introduction to Django and App EngineGDG Addis - An Introduction to Django and App Engine
GDG Addis - An Introduction to Django and App Engine
 
templates in Django material : Training available at Baabtra
templates in Django material : Training available at Baabtratemplates in Django material : Training available at Baabtra
templates in Django material : Training available at Baabtra
 
Tango with django
Tango with djangoTango with django
Tango with django
 
PyCon AU 2012 - Debugging Live Python Web Applications
PyCon AU 2012 - Debugging Live Python Web ApplicationsPyCon AU 2012 - Debugging Live Python Web Applications
PyCon AU 2012 - Debugging Live Python Web Applications
 
Seven deadly theming sins
Seven deadly theming sinsSeven deadly theming sins
Seven deadly theming sins
 
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
 
gDayX 2013 - Advanced AngularJS - Nicolas Embleton
gDayX 2013 - Advanced AngularJS - Nicolas EmbletongDayX 2013 - Advanced AngularJS - Nicolas Embleton
gDayX 2013 - Advanced AngularJS - Nicolas Embleton
 
DjangoCon 2010 Scaling Disqus
DjangoCon 2010 Scaling DisqusDjangoCon 2010 Scaling Disqus
DjangoCon 2010 Scaling Disqus
 
Django web framework
Django web frameworkDjango web framework
Django web framework
 
Angular2 inter3
Angular2 inter3Angular2 inter3
Angular2 inter3
 
Python & Django TTT
Python & Django TTTPython & Django TTT
Python & Django TTT
 
Behind the curtain - How Django handles a request
Behind the curtain - How Django handles a requestBehind the curtain - How Django handles a request
Behind the curtain - How Django handles a request
 
Untangling - fall2017 - week 9
Untangling - fall2017 - week 9Untangling - fall2017 - week 9
Untangling - fall2017 - week 9
 
Django apps and ORM Beyond the basics [Meetup hosted by Prodeers.com]
Django apps and ORM Beyond the basics [Meetup hosted by Prodeers.com]Django apps and ORM Beyond the basics [Meetup hosted by Prodeers.com]
Django apps and ORM Beyond the basics [Meetup hosted by Prodeers.com]
 
TurboGears2 Pluggable Applications
TurboGears2 Pluggable ApplicationsTurboGears2 Pluggable Applications
TurboGears2 Pluggable Applications
 

Recently uploaded

Webinar: The Art of Prioritizing Your Product Roadmap by AWS Sr PM - Tech
Webinar: The Art of Prioritizing Your Product Roadmap by AWS Sr PM - TechWebinar: The Art of Prioritizing Your Product Roadmap by AWS Sr PM - Tech
Webinar: The Art of Prioritizing Your Product Roadmap by AWS Sr PM - TechProduct School
 
How to become a GDSC Lead GDSC MI AOE.pptx
How to become a GDSC Lead GDSC MI AOE.pptxHow to become a GDSC Lead GDSC MI AOE.pptx
How to become a GDSC Lead GDSC MI AOE.pptxKaustubhBhavsar6
 
Where developers are challenged, what developers want and where DevEx is going
Where developers are challenged, what developers want and where DevEx is goingWhere developers are challenged, what developers want and where DevEx is going
Where developers are challenged, what developers want and where DevEx is goingFrancesco Corti
 
Oracle Database 23c Security New Features.pptx
Oracle Database 23c Security New Features.pptxOracle Database 23c Security New Features.pptx
Oracle Database 23c Security New Features.pptxSatishbabu Gunukula
 
From the origin to the future of Open Source model and business
From the origin to the future of  Open Source model and businessFrom the origin to the future of  Open Source model and business
From the origin to the future of Open Source model and businessFrancesco Corti
 
Automation Ops Series: Session 2 - Governance for UiPath projects
Automation Ops Series: Session 2 - Governance for UiPath projectsAutomation Ops Series: Session 2 - Governance for UiPath projects
Automation Ops Series: Session 2 - Governance for UiPath projectsDianaGray10
 
Top 10 Squarespace Development Companies
Top 10 Squarespace Development CompaniesTop 10 Squarespace Development Companies
Top 10 Squarespace Development CompaniesTopCSSGallery
 
Graphene Quantum Dots-Based Composites for Biomedical Applications
Graphene Quantum Dots-Based Composites for  Biomedical ApplicationsGraphene Quantum Dots-Based Composites for  Biomedical Applications
Graphene Quantum Dots-Based Composites for Biomedical Applicationsnooralam814309
 
Patch notes explaining DISARM Version 1.4 update
Patch notes explaining DISARM Version 1.4 updatePatch notes explaining DISARM Version 1.4 update
Patch notes explaining DISARM Version 1.4 updateadam112203
 
UiPath Studio Web workshop series - Day 4
UiPath Studio Web workshop series - Day 4UiPath Studio Web workshop series - Day 4
UiPath Studio Web workshop series - Day 4DianaGray10
 
March Patch Tuesday
March Patch TuesdayMarch Patch Tuesday
March Patch TuesdayIvanti
 
Explore the UiPath Community and ways you can benefit on your journey to auto...
Explore the UiPath Community and ways you can benefit on your journey to auto...Explore the UiPath Community and ways you can benefit on your journey to auto...
Explore the UiPath Community and ways you can benefit on your journey to auto...DianaGray10
 
GraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptx
GraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptxGraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptx
GraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptxNeo4j
 
20140402 - Smart house demo kit
20140402 - Smart house demo kit20140402 - Smart house demo kit
20140402 - Smart house demo kitJamie (Taka) Wang
 
UiPath Studio Web workshop series - Day 1
UiPath Studio Web workshop series  - Day 1UiPath Studio Web workshop series  - Day 1
UiPath Studio Web workshop series - Day 1DianaGray10
 
How to release an Open Source Dataweave Library
How to release an Open Source Dataweave LibraryHow to release an Open Source Dataweave Library
How to release an Open Source Dataweave Libraryshyamraj55
 
UiPath Studio Web workshop series - Day 2
UiPath Studio Web workshop series - Day 2UiPath Studio Web workshop series - Day 2
UiPath Studio Web workshop series - Day 2DianaGray10
 
3 Pitfalls Everyone Should Avoid with Cloud Data
3 Pitfalls Everyone Should Avoid with Cloud Data3 Pitfalls Everyone Should Avoid with Cloud Data
3 Pitfalls Everyone Should Avoid with Cloud DataEric D. Schabell
 
Technical SEO for Improved Accessibility WTS FEST
Technical SEO for Improved Accessibility  WTS FESTTechnical SEO for Improved Accessibility  WTS FEST
Technical SEO for Improved Accessibility WTS FESTBillieHyde
 

Recently uploaded (20)

Webinar: The Art of Prioritizing Your Product Roadmap by AWS Sr PM - Tech
Webinar: The Art of Prioritizing Your Product Roadmap by AWS Sr PM - TechWebinar: The Art of Prioritizing Your Product Roadmap by AWS Sr PM - Tech
Webinar: The Art of Prioritizing Your Product Roadmap by AWS Sr PM - Tech
 
How to become a GDSC Lead GDSC MI AOE.pptx
How to become a GDSC Lead GDSC MI AOE.pptxHow to become a GDSC Lead GDSC MI AOE.pptx
How to become a GDSC Lead GDSC MI AOE.pptx
 
Where developers are challenged, what developers want and where DevEx is going
Where developers are challenged, what developers want and where DevEx is goingWhere developers are challenged, what developers want and where DevEx is going
Where developers are challenged, what developers want and where DevEx is going
 
Oracle Database 23c Security New Features.pptx
Oracle Database 23c Security New Features.pptxOracle Database 23c Security New Features.pptx
Oracle Database 23c Security New Features.pptx
 
From the origin to the future of Open Source model and business
From the origin to the future of  Open Source model and businessFrom the origin to the future of  Open Source model and business
From the origin to the future of Open Source model and business
 
Automation Ops Series: Session 2 - Governance for UiPath projects
Automation Ops Series: Session 2 - Governance for UiPath projectsAutomation Ops Series: Session 2 - Governance for UiPath projects
Automation Ops Series: Session 2 - Governance for UiPath projects
 
Top 10 Squarespace Development Companies
Top 10 Squarespace Development CompaniesTop 10 Squarespace Development Companies
Top 10 Squarespace Development Companies
 
Graphene Quantum Dots-Based Composites for Biomedical Applications
Graphene Quantum Dots-Based Composites for  Biomedical ApplicationsGraphene Quantum Dots-Based Composites for  Biomedical Applications
Graphene Quantum Dots-Based Composites for Biomedical Applications
 
SheDev 2024
SheDev 2024SheDev 2024
SheDev 2024
 
Patch notes explaining DISARM Version 1.4 update
Patch notes explaining DISARM Version 1.4 updatePatch notes explaining DISARM Version 1.4 update
Patch notes explaining DISARM Version 1.4 update
 
UiPath Studio Web workshop series - Day 4
UiPath Studio Web workshop series - Day 4UiPath Studio Web workshop series - Day 4
UiPath Studio Web workshop series - Day 4
 
March Patch Tuesday
March Patch TuesdayMarch Patch Tuesday
March Patch Tuesday
 
Explore the UiPath Community and ways you can benefit on your journey to auto...
Explore the UiPath Community and ways you can benefit on your journey to auto...Explore the UiPath Community and ways you can benefit on your journey to auto...
Explore the UiPath Community and ways you can benefit on your journey to auto...
 
GraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptx
GraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptxGraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptx
GraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptx
 
20140402 - Smart house demo kit
20140402 - Smart house demo kit20140402 - Smart house demo kit
20140402 - Smart house demo kit
 
UiPath Studio Web workshop series - Day 1
UiPath Studio Web workshop series  - Day 1UiPath Studio Web workshop series  - Day 1
UiPath Studio Web workshop series - Day 1
 
How to release an Open Source Dataweave Library
How to release an Open Source Dataweave LibraryHow to release an Open Source Dataweave Library
How to release an Open Source Dataweave Library
 
UiPath Studio Web workshop series - Day 2
UiPath Studio Web workshop series - Day 2UiPath Studio Web workshop series - Day 2
UiPath Studio Web workshop series - Day 2
 
3 Pitfalls Everyone Should Avoid with Cloud Data
3 Pitfalls Everyone Should Avoid with Cloud Data3 Pitfalls Everyone Should Avoid with Cloud Data
3 Pitfalls Everyone Should Avoid with Cloud Data
 
Technical SEO for Improved Accessibility WTS FEST
Technical SEO for Improved Accessibility  WTS FESTTechnical SEO for Improved Accessibility  WTS FEST
Technical SEO for Improved Accessibility WTS FEST
 

國民雲端架構 Django + GAE

  • 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 models from datetime import datetime class 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_exempt def 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)
  • 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)
  • 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 cache insureme_blog_rss_url = 'http://blog.insureme.com.tw/feeds/posts/default' def 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/default' def 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 Cache Concurrency Level: 10 Concurrency Level: 10 Time taken for tests: 590.238 seconds Time taken for tests: 237.262 seconds Complete requests: 2000 Complete requests: 2000 Failed requests: 1 Failed requests: 0 Write errors: 0 Write errors: 0 Total transferred: 1619817 bytes Total transferred: 1620000 bytes HTML transferred: 1313809 bytes HTML transferred: 1314000 bytes Requests 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 • •
  • 37. THANK YOU!! • url: http://techblog.insureme.com.tw • twitter: wingchen83

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n