SlideShare a Scribd company logo
1 of 37
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

DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 

Recently uploaded (20)

DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 

國民雲端架構 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