SlideShare a Scribd company logo
Google App Engine


                Writing a
         Stack Overflow clone
             on App Engine
           in under an hour*


            http://blog.bitquabit.com/2009/07/01/one-which-i-call-out-hacker-news/
Agenda

1. App Engine Introduction
2. Demo: Building an app
3. Demo: Deploying an app
4. Demo: Writing App Overflow
5. App Engine's Services
6. Questions

  If I say "Cloud" at any point, Boo!
App Engine
introduction
Building web applications is hard
Thinking about scalability

Just a few users....




               ....the tools, platform and design
               don't matter too much
Thinking about scalability

Lots and lots of users...




               ....you must design for scalability
WhiteHouse.gov/openforquestions
Serving developers AND their customers
Google App Engine
                       Scalable

                       High Performance

                       Standards

                       Cost effective
The Components
1. Scalable Serving Architecture




                   creative commons licensed photograph from cote
1. Scalable Serving Architecture


                             Incoming Requests



                App Engine      App Engine       App Engine
                 Front End       Front End        Front End
Load Balancer


                AppServer       AppServer        AppServer
1. Scalable Serving Architecture


                                    Incoming Requests



                      App Engine       App Engine                App Engine
                       Front End        Front End                 Front End
Load Balancer


                      AppServer        AppServer                 AppServer




                                                    Other Google
      AppServer                                     Infrastructure

                  API Layer                         - Bigtable

                                                    - Google Accounts

          App       App       App                   - Memcache

                                                    - Image manipulation
2. Distributed Datastore

The Datastore is...

   Distributed

   Transactional

   Natively Partitioned

   Hierarchial                  Wow. That is
                                one big table.
   Schemaless

   Based on Bigtable
2. Distributed Datastore

The Datastore is not...

   A relational database

   A SQL engine

   Just Bigtable
                                Wow. That is
                                one big table.
Demo: Writing an app
App configuration

application: appoverflow
version: 1
runtime: python
api_version: 1

handlers:
- url: /.*
  script: /request.py
Request handling

class IndexHandler(webapp.RequestHandler):
 def render_template(self, name, values):
   path = os.path.join(os.path.dirname(__file__),
                'templates', name)
   self.response.out.write(template.render(path, values))

 def get(self):
  self.render_template('index.html', {})

application = webapp.WSGIApplication([
   ('/', IndexHandler),
], debug=True)

def main():
 run_wsgi_app(application)
Demo: Deploying an app
  In 30 seconds or less. Time me!
Demo: Writing App Overflow
Adding authentication

class IndexHandler(webapp.RequestHandler):
 def __init__(self):
   self.user = users.get_current_user()

 def render_template(self, name, values):
  url = self.request.url
  template_values.update({
     'user': self.user,
     'login_url':users.create_login_url(url),
     'logout_url':users.create_logout_url(url),
  })
  path = os.path.join(os.path.dirname(__file__),
                 'templates', template_name)
  self.response.out.write(template.render(path,
                    template_values))
Adding authentication

<html>
<head>
 <title>{%block title%}App Overflow{%endblock%}</title>
 {% block head %}{% endblock %}
</head>
<body>
 <div class="login">
  {% if user %}
    Logged in as {{user.nickname}} |
    <a href="{{logout_url}}">Log Out</a>
  {% else %}
    <a href="{{login_url}}">Log In</a>
  {% endif %}
 </div>
 {% block body %}{% endblock %}
</body>
</html>
Storing data

from google.appengine.ext import db

class Question(db.Model):
 asker = db.UserProperty(required=True)
 title = db.StringProperty(required=True, indexed=False)
 body = db.TextProperty(required=True)
 asked_at = db.DateTimeProperty(auto_now_add=True)
Storing data

class NewQuestionHandler(BaseHandler):
 def get(self):
   self.render_form(forms.QuestionForm())

 def post(self):
  form = forms.QuestionForm(self.request.POST)
  if not form.is_valid():
    self.render_form(form)
    return

  entity = models.Question(
     asker=self.user,
     **form.clean_data)
  entity.put()
  self.redirect('/questions/%d/' % (entity.key().id(),))
Fetching data

class QuestionHandler(BaseHandler):
 def get_question(self, id):
   question = models.Question.get_by_id(int(id))
   return question

 def render_page(self, question):
  template_values = {
     'question': question,
  }
  self.render_template('question.html', template_values)

 def get(self, id):
  question = self.get_question(id)
  if question:
    self.render_page(question)
Queries

class IndexHandler(BaseHandler):
 def get_questions(self):
   q = models.Question.all()
   q.order('-asked_at')
   return q.fetch(20)

 def render_page(self):
  template_values = {
    'questions': self.get_questions(),
  }
  self.render_template('index.html', template_values)

 def get(self):
  self.render_page()
Precomputation

class Question(db.Model):
 asker = db.UserProperty(required=True)
 title = db.StringProperty(required=True, indexed=False)
 body = db.TextProperty(required=True)
 asked_at = db.DateTimeProperty(auto_now_add=True)
 answer_count = db.IntegerProperty(required=True,
                       default=0)

class Answer(db.Model):
 answerer = db.UserProperty(required=True)
 body = db.TextProperty(required=True)
 answered_at = db.DateTimeProperty(auto_now_add=True)
Transactions

answer = models.Answer(
  parent=question,
  answerer=self.user,
  # ...
)

def save_answer(answer):
 def _tx():
  question = db.get(answer.parent().key())
  question.answer_count += 1
  db.put([answer, question])
  return answer.key()
 return db.run_in_transaction(_tx)
XMPP

class XmppHandler(xmpp_handlers.CommandHandler):
  def ask_command(self, message=None):
   question = models.Question(
      title=message.arg,
      body=message.arg,
      sender=message.sender)
   question.put()
   message.reply('Your question has been received. You will be pinged when an answer
is submitted.')

# Elsewhere...

xmpp.send_message([question.sender], 'Answer: ' +
         answer.body)
Additional services / APIs

 URL Fetch
 Memcache
 Mail - incoming and outgoing
 Images
 Google Accounts
 Cron support
 Task Queue
Questions?

More Related Content

What's hot

Revised Rails Engine Patterns for Montreal.rb meetup Oct 16, 2012
Revised Rails Engine Patterns for Montreal.rb meetup Oct 16, 2012Revised Rails Engine Patterns for Montreal.rb meetup Oct 16, 2012
Revised Rails Engine Patterns for Montreal.rb meetup Oct 16, 2012Andy Maleh
 
In The Trenches With Tomster, Upgrading Ember.js & Ember Data
In The Trenches With Tomster, Upgrading Ember.js & Ember DataIn The Trenches With Tomster, Upgrading Ember.js & Ember Data
In The Trenches With Tomster, Upgrading Ember.js & Ember Data
Stacy London
 
AEM Best Practices for Component Development
AEM Best Practices for Component DevelopmentAEM Best Practices for Component Development
AEM Best Practices for Component Development
Gabriel Walt
 
Oracle MAF real life OOW.pptx
Oracle MAF real life OOW.pptxOracle MAF real life OOW.pptx
Oracle MAF real life OOW.pptx
Luc Bors
 
AEM Sightly Deep Dive
AEM Sightly Deep DiveAEM Sightly Deep Dive
AEM Sightly Deep Dive
Gabriel Walt
 
App engine devfest_mexico_10
App engine devfest_mexico_10App engine devfest_mexico_10
App engine devfest_mexico_10Chris Schalk
 
Google app engine by example
Google app engine by exampleGoogle app engine by example
Google app engine by example
Alexander Zamkovyi
 
Dynamic components using SPA concepts in AEM
Dynamic components using SPA concepts in AEMDynamic components using SPA concepts in AEM
Dynamic components using SPA concepts in AEM
Bojana Popovska
 
Sling Dynamic Include
Sling Dynamic IncludeSling Dynamic Include
Sling Dynamic Include
Tomasz Rękawek
 
Deploying applications to Cloud with Google App Engine
Deploying applications to Cloud with Google App EngineDeploying applications to Cloud with Google App Engine
Deploying applications to Cloud with Google App Engine
Alexander Zamkovyi
 
Adobe Experience Manager Core Components
Adobe Experience Manager Core ComponentsAdobe Experience Manager Core Components
Adobe Experience Manager Core Components
Gabriel Walt
 
Three WEM Dev Tricks
Three WEM Dev TricksThree WEM Dev Tricks
Three WEM Dev TricksGabriel Walt
 
26 top angular 8 interview questions to know in 2020 [www.full stack.cafe]
26 top angular 8 interview questions to know in 2020   [www.full stack.cafe]26 top angular 8 interview questions to know in 2020   [www.full stack.cafe]
26 top angular 8 interview questions to know in 2020 [www.full stack.cafe]
Alex Ershov
 
Meet AWS SAM
Meet AWS SAMMeet AWS SAM
Meet AWS SAM
Eric Johnson
 
Dynamic Components using Single-Page-Application Concepts in AEM/CQ
Dynamic Components using Single-Page-Application Concepts in AEM/CQDynamic Components using Single-Page-Application Concepts in AEM/CQ
Dynamic Components using Single-Page-Application Concepts in AEM/CQ
Netcetera
 
Creation&imitation
Creation&imitationCreation&imitation
Creation&imitation
Tae Young Lee
 
Introduction to Sightly and Sling Models
Introduction to Sightly and Sling ModelsIntroduction to Sightly and Sling Models
Introduction to Sightly and Sling Models
Stefano Celentano
 
ActionBarCompat Tutorial-Part 1(Prepare and Setup)
ActionBarCompat Tutorial-Part 1(Prepare and Setup)ActionBarCompat Tutorial-Part 1(Prepare and Setup)
ActionBarCompat Tutorial-Part 1(Prepare and Setup)
Haining Lee
 
CQ Provisionning & Authoring
CQ Provisionning & AuthoringCQ Provisionning & Authoring
CQ Provisionning & Authoring
Gabriel Walt
 

What's hot (20)

Revised Rails Engine Patterns for Montreal.rb meetup Oct 16, 2012
Revised Rails Engine Patterns for Montreal.rb meetup Oct 16, 2012Revised Rails Engine Patterns for Montreal.rb meetup Oct 16, 2012
Revised Rails Engine Patterns for Montreal.rb meetup Oct 16, 2012
 
In The Trenches With Tomster, Upgrading Ember.js & Ember Data
In The Trenches With Tomster, Upgrading Ember.js & Ember DataIn The Trenches With Tomster, Upgrading Ember.js & Ember Data
In The Trenches With Tomster, Upgrading Ember.js & Ember Data
 
AEM Best Practices for Component Development
AEM Best Practices for Component DevelopmentAEM Best Practices for Component Development
AEM Best Practices for Component Development
 
Oracle MAF real life OOW.pptx
Oracle MAF real life OOW.pptxOracle MAF real life OOW.pptx
Oracle MAF real life OOW.pptx
 
AEM Sightly Deep Dive
AEM Sightly Deep DiveAEM Sightly Deep Dive
AEM Sightly Deep Dive
 
App engine devfest_mexico_10
App engine devfest_mexico_10App engine devfest_mexico_10
App engine devfest_mexico_10
 
Google app engine by example
Google app engine by exampleGoogle app engine by example
Google app engine by example
 
Dynamic components using SPA concepts in AEM
Dynamic components using SPA concepts in AEMDynamic components using SPA concepts in AEM
Dynamic components using SPA concepts in AEM
 
Sling Dynamic Include
Sling Dynamic IncludeSling Dynamic Include
Sling Dynamic Include
 
Deploying applications to Cloud with Google App Engine
Deploying applications to Cloud with Google App EngineDeploying applications to Cloud with Google App Engine
Deploying applications to Cloud with Google App Engine
 
Adobe Experience Manager Core Components
Adobe Experience Manager Core ComponentsAdobe Experience Manager Core Components
Adobe Experience Manager Core Components
 
Three WEM Dev Tricks
Three WEM Dev TricksThree WEM Dev Tricks
Three WEM Dev Tricks
 
Rails engines
Rails enginesRails engines
Rails engines
 
26 top angular 8 interview questions to know in 2020 [www.full stack.cafe]
26 top angular 8 interview questions to know in 2020   [www.full stack.cafe]26 top angular 8 interview questions to know in 2020   [www.full stack.cafe]
26 top angular 8 interview questions to know in 2020 [www.full stack.cafe]
 
Meet AWS SAM
Meet AWS SAMMeet AWS SAM
Meet AWS SAM
 
Dynamic Components using Single-Page-Application Concepts in AEM/CQ
Dynamic Components using Single-Page-Application Concepts in AEM/CQDynamic Components using Single-Page-Application Concepts in AEM/CQ
Dynamic Components using Single-Page-Application Concepts in AEM/CQ
 
Creation&imitation
Creation&imitationCreation&imitation
Creation&imitation
 
Introduction to Sightly and Sling Models
Introduction to Sightly and Sling ModelsIntroduction to Sightly and Sling Models
Introduction to Sightly and Sling Models
 
ActionBarCompat Tutorial-Part 1(Prepare and Setup)
ActionBarCompat Tutorial-Part 1(Prepare and Setup)ActionBarCompat Tutorial-Part 1(Prepare and Setup)
ActionBarCompat Tutorial-Part 1(Prepare and Setup)
 
CQ Provisionning & Authoring
CQ Provisionning & AuthoringCQ Provisionning & Authoring
CQ Provisionning & Authoring
 

Viewers also liked

Programación cultural marzo 2013 musa
Programación cultural marzo 2013 musaProgramación cultural marzo 2013 musa
Programación cultural marzo 2013 musaboletinmusa
 
Biblioteca digital ics tutors
Biblioteca digital ics tutorsBiblioteca digital ics tutors
Biblioteca digital ics tutorsfseics
 
Neoplasias de las glándulas salivales
Neoplasias de las glándulas salivalesNeoplasias de las glándulas salivales
Neoplasias de las glándulas salivales
Dr. Alan Burgos
 
El tabudo pagina web_ETU 1-1_grupo2
El tabudo pagina web_ETU 1-1_grupo2El tabudo pagina web_ETU 1-1_grupo2
El tabudo pagina web_ETU 1-1_grupo2Julissa Contreras
 
Rodante Entrevistas 2009 BCN
Rodante Entrevistas 2009 BCNRodante Entrevistas 2009 BCN
Rodante Entrevistas 2009 BCNmh_larocca
 
Educação a distância
Educação a distânciaEducação a distância
Educação a distância
paoolabernardes
 
Campanha de Verão - Prisma, Instituto de Formação
Campanha de Verão - Prisma, Instituto de FormaçãoCampanha de Verão - Prisma, Instituto de Formação
Campanha de Verão - Prisma, Instituto de Formação
mcdilolisboa
 
Bernardo !
Bernardo !Bernardo !
Bernardo !alunossc
 
O holocausto
O holocaustoO holocausto
O holocaustodaniel
 
Amor & amizade
Amor & amizadeAmor & amizade
Amor & amizadeJanailde
 
Docência em baixa
Docência em baixaDocência em baixa
Docência em baixa
Jose Bezerra
 
Jornada cientifica 2007 diego silva lemelle
Jornada cientifica 2007 diego silva lemelleJornada cientifica 2007 diego silva lemelle
Jornada cientifica 2007 diego silva lemelle
Diego Silva Lemelle
 
Programación cultural noviembre
Programación cultural noviembreProgramación cultural noviembre
Programación cultural noviembre
boletinmusa
 
Projeto livro de histórias da bruxa halloween
Projeto   livro de histórias da bruxa halloweenProjeto   livro de histórias da bruxa halloween
Projeto livro de histórias da bruxa halloween
SaraHonorio
 
Silvio ibiapino
Silvio ibiapinoSilvio ibiapino
Silvio ibiapino
Janailde
 
Cartilha de Orientação do PRONAF 2011/2012
Cartilha de Orientação do PRONAF 2011/2012Cartilha de Orientação do PRONAF 2011/2012
Cartilha de Orientação do PRONAF 2011/2012
FETAEP
 

Viewers also liked (20)

Programación cultural marzo 2013 musa
Programación cultural marzo 2013 musaProgramación cultural marzo 2013 musa
Programación cultural marzo 2013 musa
 
Contador (1)
Contador (1)Contador (1)
Contador (1)
 
Biblioteca digital ics tutors
Biblioteca digital ics tutorsBiblioteca digital ics tutors
Biblioteca digital ics tutors
 
Neoplasias de las glándulas salivales
Neoplasias de las glándulas salivalesNeoplasias de las glándulas salivales
Neoplasias de las glándulas salivales
 
As cidades (matéria)
As cidades (matéria)As cidades (matéria)
As cidades (matéria)
 
Rc.lidia campos estructura
Rc.lidia campos estructuraRc.lidia campos estructura
Rc.lidia campos estructura
 
El tabudo pagina web_ETU 1-1_grupo2
El tabudo pagina web_ETU 1-1_grupo2El tabudo pagina web_ETU 1-1_grupo2
El tabudo pagina web_ETU 1-1_grupo2
 
Rodante Entrevistas 2009 BCN
Rodante Entrevistas 2009 BCNRodante Entrevistas 2009 BCN
Rodante Entrevistas 2009 BCN
 
Educação a distância
Educação a distânciaEducação a distância
Educação a distância
 
Campanha de Verão - Prisma, Instituto de Formação
Campanha de Verão - Prisma, Instituto de FormaçãoCampanha de Verão - Prisma, Instituto de Formação
Campanha de Verão - Prisma, Instituto de Formação
 
Bernardo !
Bernardo !Bernardo !
Bernardo !
 
O holocausto
O holocaustoO holocausto
O holocausto
 
Amor & amizade
Amor & amizadeAmor & amizade
Amor & amizade
 
Download 6-48
Download 6-48Download 6-48
Download 6-48
 
Docência em baixa
Docência em baixaDocência em baixa
Docência em baixa
 
Jornada cientifica 2007 diego silva lemelle
Jornada cientifica 2007 diego silva lemelleJornada cientifica 2007 diego silva lemelle
Jornada cientifica 2007 diego silva lemelle
 
Programación cultural noviembre
Programación cultural noviembreProgramación cultural noviembre
Programación cultural noviembre
 
Projeto livro de histórias da bruxa halloween
Projeto   livro de histórias da bruxa halloweenProjeto   livro de histórias da bruxa halloween
Projeto livro de histórias da bruxa halloween
 
Silvio ibiapino
Silvio ibiapinoSilvio ibiapino
Silvio ibiapino
 
Cartilha de Orientação do PRONAF 2011/2012
Cartilha de Orientação do PRONAF 2011/2012Cartilha de Orientação do PRONAF 2011/2012
Cartilha de Orientação do PRONAF 2011/2012
 

Similar to Python Ireland Nov 2009 Talk - Appengine

App Engine On Air: Munich
App Engine On Air: MunichApp Engine On Air: Munich
App Engine On Air: Munich
dion
 
From Backbone to Ember and Back(bone) Again
From Backbone to Ember and Back(bone) AgainFrom Backbone to Ember and Back(bone) Again
From Backbone to Ember and Back(bone) Again
jonknapp
 
App Engine overview (Android meetup 06-10)
App Engine overview (Android meetup 06-10)App Engine overview (Android meetup 06-10)
App Engine overview (Android meetup 06-10)jasonacooper
 
Elefrant [ng-Poznan]
Elefrant [ng-Poznan]Elefrant [ng-Poznan]
Elefrant [ng-Poznan]
Marcos Latorre
 
Google App Engine for Java
Google App Engine for JavaGoogle App Engine for Java
Google App Engine for Java
Lars Vogel
 
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.js
ForwardJS 2017 -  Fullstack end-to-end Test Automation with node.jsForwardJS 2017 -  Fullstack end-to-end Test Automation with node.js
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.js
Mek Srunyu Stittri
 
Google App Engine
Google App EngineGoogle App Engine
Google App Engine
Software Park Thailand
 
Tech UG - Newcastle 09-17 - logic apps
Tech UG - Newcastle 09-17 -   logic appsTech UG - Newcastle 09-17 -   logic apps
Tech UG - Newcastle 09-17 - logic apps
Michael Stephenson
 
Maciej Treder "Server-side rendering with Angular—be faster and more SEO, CDN...
Maciej Treder "Server-side rendering with Angular—be faster and more SEO, CDN...Maciej Treder "Server-side rendering with Angular—be faster and more SEO, CDN...
Maciej Treder "Server-side rendering with Angular—be faster and more SEO, CDN...
Fwdays
 
Charla desarrollo de apps con sharepoint y office 365
Charla   desarrollo de apps con sharepoint y office 365Charla   desarrollo de apps con sharepoint y office 365
Charla desarrollo de apps con sharepoint y office 365
Luis Valencia
 
Developing Java Web Applications In Google App Engine
Developing Java Web Applications In Google App EngineDeveloping Java Web Applications In Google App Engine
Developing Java Web Applications In Google App Engine
Tahir Akram
 
Javascript Frameworks for Well Architected, Immersive Web Apps
Javascript Frameworks for Well Architected, Immersive Web AppsJavascript Frameworks for Well Architected, Immersive Web Apps
Javascript Frameworks for Well Architected, Immersive Web Apps
dnelson-cs
 
Reactive application using meteor
Reactive application using meteorReactive application using meteor
Reactive application using meteor
Sapna Upreti
 
Gentle App Engine Intro
Gentle App Engine IntroGentle App Engine Intro
Gentle App Engine Intro
robinb123
 
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJSAngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
murtazahaveliwala
 
Serverless Application Development with SAM
Serverless Application Development with SAMServerless Application Development with SAM
Serverless Application Development with SAM
Amazon Web Services
 
Google App Engine overview (GAE/J)
Google App Engine overview (GAE/J)Google App Engine overview (GAE/J)
Google App Engine overview (GAE/J)
Moch Nasrullah Rahmani
 
using Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API'susing Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API's
Antônio Roberto Silva
 
Creating a World-Class RESTful Web Services API
Creating a World-Class RESTful Web Services APICreating a World-Class RESTful Web Services API
Creating a World-Class RESTful Web Services API
David Keener
 
C# and ASP.NET Code and Data-Access Security
C# and ASP.NET Code and Data-Access SecurityC# and ASP.NET Code and Data-Access Security
C# and ASP.NET Code and Data-Access SecurityDarren Sim
 

Similar to Python Ireland Nov 2009 Talk - Appengine (20)

App Engine On Air: Munich
App Engine On Air: MunichApp Engine On Air: Munich
App Engine On Air: Munich
 
From Backbone to Ember and Back(bone) Again
From Backbone to Ember and Back(bone) AgainFrom Backbone to Ember and Back(bone) Again
From Backbone to Ember and Back(bone) Again
 
App Engine overview (Android meetup 06-10)
App Engine overview (Android meetup 06-10)App Engine overview (Android meetup 06-10)
App Engine overview (Android meetup 06-10)
 
Elefrant [ng-Poznan]
Elefrant [ng-Poznan]Elefrant [ng-Poznan]
Elefrant [ng-Poznan]
 
Google App Engine for Java
Google App Engine for JavaGoogle App Engine for Java
Google App Engine for Java
 
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.js
ForwardJS 2017 -  Fullstack end-to-end Test Automation with node.jsForwardJS 2017 -  Fullstack end-to-end Test Automation with node.js
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.js
 
Google App Engine
Google App EngineGoogle App Engine
Google App Engine
 
Tech UG - Newcastle 09-17 - logic apps
Tech UG - Newcastle 09-17 -   logic appsTech UG - Newcastle 09-17 -   logic apps
Tech UG - Newcastle 09-17 - logic apps
 
Maciej Treder "Server-side rendering with Angular—be faster and more SEO, CDN...
Maciej Treder "Server-side rendering with Angular—be faster and more SEO, CDN...Maciej Treder "Server-side rendering with Angular—be faster and more SEO, CDN...
Maciej Treder "Server-side rendering with Angular—be faster and more SEO, CDN...
 
Charla desarrollo de apps con sharepoint y office 365
Charla   desarrollo de apps con sharepoint y office 365Charla   desarrollo de apps con sharepoint y office 365
Charla desarrollo de apps con sharepoint y office 365
 
Developing Java Web Applications In Google App Engine
Developing Java Web Applications In Google App EngineDeveloping Java Web Applications In Google App Engine
Developing Java Web Applications In Google App Engine
 
Javascript Frameworks for Well Architected, Immersive Web Apps
Javascript Frameworks for Well Architected, Immersive Web AppsJavascript Frameworks for Well Architected, Immersive Web Apps
Javascript Frameworks for Well Architected, Immersive Web Apps
 
Reactive application using meteor
Reactive application using meteorReactive application using meteor
Reactive application using meteor
 
Gentle App Engine Intro
Gentle App Engine IntroGentle App Engine Intro
Gentle App Engine Intro
 
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJSAngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
 
Serverless Application Development with SAM
Serverless Application Development with SAMServerless Application Development with SAM
Serverless Application Development with SAM
 
Google App Engine overview (GAE/J)
Google App Engine overview (GAE/J)Google App Engine overview (GAE/J)
Google App Engine overview (GAE/J)
 
using Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API'susing Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API's
 
Creating a World-Class RESTful Web Services API
Creating a World-Class RESTful Web Services APICreating a World-Class RESTful Web Services API
Creating a World-Class RESTful Web Services API
 
C# and ASP.NET Code and Data-Access Security
C# and ASP.NET Code and Data-Access SecurityC# and ASP.NET Code and Data-Access Security
C# and ASP.NET Code and Data-Access Security
 

More from Python Ireland

Async I/O in Python
Async I/O in PythonAsync I/O in Python
Async I/O in Python
Python Ireland
 
Python Ireland 2012 - Message brokers and Python by Fernando Ciciliati
Python Ireland 2012 - Message brokers and Python by Fernando Ciciliati Python Ireland 2012 - Message brokers and Python by Fernando Ciciliati
Python Ireland 2012 - Message brokers and Python by Fernando Ciciliati
Python Ireland
 
Python Ireland - Who, how, what
Python Ireland - Who, how, whatPython Ireland - Who, how, what
Python Ireland - Who, how, what
Python Ireland
 
Object Orientation vs. Functional Programming in Python
Object Orientation vs. Functional Programming in PythonObject Orientation vs. Functional Programming in Python
Object Orientation vs. Functional Programming in Python
Python Ireland
 
What's the Scoop with Python 3?
What's the Scoop with Python 3?What's the Scoop with Python 3?
What's the Scoop with Python 3?
Python Ireland
 
Google App Engine in 40 minutes (the absolute essentials)
Google App Engine in 40 minutes (the absolute essentials)Google App Engine in 40 minutes (the absolute essentials)
Google App Engine in 40 minutes (the absolute essentials)
Python Ireland
 
Introduction to Erlang for Python Programmers
Introduction to Erlang for Python ProgrammersIntroduction to Erlang for Python Programmers
Introduction to Erlang for Python Programmers
Python Ireland
 
Web-service based Mobile Geospatial Application Development using Python
Web-service based Mobile Geospatial Application Development using PythonWeb-service based Mobile Geospatial Application Development using Python
Web-service based Mobile Geospatial Application Development using Python
Python Ireland
 
Utopia Kingdoms scaling case. From 4 users to 50.000+
Utopia Kingdoms scaling case. From 4 users to 50.000+Utopia Kingdoms scaling case. From 4 users to 50.000+
Utopia Kingdoms scaling case. From 4 users to 50.000+
Python Ireland
 
The Larch - a visual interactive programming environment
The Larch - a visual interactive programming environmentThe Larch - a visual interactive programming environment
The Larch - a visual interactive programming environment
Python Ireland
 
Python vs JLizard.... a python logging experience
Python vs JLizard.... a python logging experiencePython vs JLizard.... a python logging experience
Python vs JLizard.... a python logging experience
Python Ireland
 
Vim and Python
Vim and PythonVim and Python
Vim and Python
Python Ireland
 
Python Ireland May 2011 - What is Pyramid and where is it with respect to Dja...
Python Ireland May 2011 - What is Pyramid and where is it with respect to Dja...Python Ireland May 2011 - What is Pyramid and where is it with respect to Dja...
Python Ireland May 2011 - What is Pyramid and where is it with respect to Dja...
Python Ireland
 
Python Ireland Nov 2010 Talk: Unit Testing
Python Ireland Nov 2010 Talk: Unit TestingPython Ireland Nov 2010 Talk: Unit Testing
Python Ireland Nov 2010 Talk: Unit Testing
Python Ireland
 
Python Ireland Nov 2010 - RESTing with Django
Python Ireland Nov 2010 - RESTing with DjangoPython Ireland Nov 2010 - RESTing with Django
Python Ireland Nov 2010 - RESTing with Django
Python Ireland
 
Python Ireland Feb '11 Talks: Introduction to Python
Python Ireland Feb '11 Talks: Introduction to PythonPython Ireland Feb '11 Talks: Introduction to Python
Python Ireland Feb '11 Talks: Introduction to Python
Python Ireland
 
Python Ireland Dec Talks - Windows Azure -- The Nuts and Bolts
Python Ireland Dec Talks - Windows Azure -- The Nuts and BoltsPython Ireland Dec Talks - Windows Azure -- The Nuts and Bolts
Python Ireland Dec Talks - Windows Azure -- The Nuts and Bolts
Python Ireland
 
Lambada
LambadaLambada
Python for cloud computing
Python for cloud computingPython for cloud computing
Python for cloud computing
Python Ireland
 
IPython: The awesome python shell
IPython: The awesome python shellIPython: The awesome python shell
IPython: The awesome python shell
Python Ireland
 

More from Python Ireland (20)

Async I/O in Python
Async I/O in PythonAsync I/O in Python
Async I/O in Python
 
Python Ireland 2012 - Message brokers and Python by Fernando Ciciliati
Python Ireland 2012 - Message brokers and Python by Fernando Ciciliati Python Ireland 2012 - Message brokers and Python by Fernando Ciciliati
Python Ireland 2012 - Message brokers and Python by Fernando Ciciliati
 
Python Ireland - Who, how, what
Python Ireland - Who, how, whatPython Ireland - Who, how, what
Python Ireland - Who, how, what
 
Object Orientation vs. Functional Programming in Python
Object Orientation vs. Functional Programming in PythonObject Orientation vs. Functional Programming in Python
Object Orientation vs. Functional Programming in Python
 
What's the Scoop with Python 3?
What's the Scoop with Python 3?What's the Scoop with Python 3?
What's the Scoop with Python 3?
 
Google App Engine in 40 minutes (the absolute essentials)
Google App Engine in 40 minutes (the absolute essentials)Google App Engine in 40 minutes (the absolute essentials)
Google App Engine in 40 minutes (the absolute essentials)
 
Introduction to Erlang for Python Programmers
Introduction to Erlang for Python ProgrammersIntroduction to Erlang for Python Programmers
Introduction to Erlang for Python Programmers
 
Web-service based Mobile Geospatial Application Development using Python
Web-service based Mobile Geospatial Application Development using PythonWeb-service based Mobile Geospatial Application Development using Python
Web-service based Mobile Geospatial Application Development using Python
 
Utopia Kingdoms scaling case. From 4 users to 50.000+
Utopia Kingdoms scaling case. From 4 users to 50.000+Utopia Kingdoms scaling case. From 4 users to 50.000+
Utopia Kingdoms scaling case. From 4 users to 50.000+
 
The Larch - a visual interactive programming environment
The Larch - a visual interactive programming environmentThe Larch - a visual interactive programming environment
The Larch - a visual interactive programming environment
 
Python vs JLizard.... a python logging experience
Python vs JLizard.... a python logging experiencePython vs JLizard.... a python logging experience
Python vs JLizard.... a python logging experience
 
Vim and Python
Vim and PythonVim and Python
Vim and Python
 
Python Ireland May 2011 - What is Pyramid and where is it with respect to Dja...
Python Ireland May 2011 - What is Pyramid and where is it with respect to Dja...Python Ireland May 2011 - What is Pyramid and where is it with respect to Dja...
Python Ireland May 2011 - What is Pyramid and where is it with respect to Dja...
 
Python Ireland Nov 2010 Talk: Unit Testing
Python Ireland Nov 2010 Talk: Unit TestingPython Ireland Nov 2010 Talk: Unit Testing
Python Ireland Nov 2010 Talk: Unit Testing
 
Python Ireland Nov 2010 - RESTing with Django
Python Ireland Nov 2010 - RESTing with DjangoPython Ireland Nov 2010 - RESTing with Django
Python Ireland Nov 2010 - RESTing with Django
 
Python Ireland Feb '11 Talks: Introduction to Python
Python Ireland Feb '11 Talks: Introduction to PythonPython Ireland Feb '11 Talks: Introduction to Python
Python Ireland Feb '11 Talks: Introduction to Python
 
Python Ireland Dec Talks - Windows Azure -- The Nuts and Bolts
Python Ireland Dec Talks - Windows Azure -- The Nuts and BoltsPython Ireland Dec Talks - Windows Azure -- The Nuts and Bolts
Python Ireland Dec Talks - Windows Azure -- The Nuts and Bolts
 
Lambada
LambadaLambada
Lambada
 
Python for cloud computing
Python for cloud computingPython for cloud computing
Python for cloud computing
 
IPython: The awesome python shell
IPython: The awesome python shellIPython: The awesome python shell
IPython: The awesome python shell
 

Recently uploaded

To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 

Recently uploaded (20)

To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 

Python Ireland Nov 2009 Talk - Appengine

  • 1. Google App Engine Writing a Stack Overflow clone on App Engine in under an hour* http://blog.bitquabit.com/2009/07/01/one-which-i-call-out-hacker-news/
  • 2. Agenda 1. App Engine Introduction 2. Demo: Building an app 3. Demo: Deploying an app 4. Demo: Writing App Overflow 5. App Engine's Services 6. Questions If I say "Cloud" at any point, Boo!
  • 5. Thinking about scalability Just a few users.... ....the tools, platform and design don't matter too much
  • 6. Thinking about scalability Lots and lots of users... ....you must design for scalability
  • 8. Serving developers AND their customers Google App Engine Scalable High Performance Standards Cost effective
  • 10. 1. Scalable Serving Architecture creative commons licensed photograph from cote
  • 11. 1. Scalable Serving Architecture Incoming Requests App Engine App Engine App Engine Front End Front End Front End Load Balancer AppServer AppServer AppServer
  • 12. 1. Scalable Serving Architecture Incoming Requests App Engine App Engine App Engine Front End Front End Front End Load Balancer AppServer AppServer AppServer Other Google AppServer Infrastructure API Layer - Bigtable - Google Accounts App App App - Memcache - Image manipulation
  • 13. 2. Distributed Datastore The Datastore is... Distributed Transactional Natively Partitioned Hierarchial Wow. That is one big table. Schemaless Based on Bigtable
  • 14. 2. Distributed Datastore The Datastore is not... A relational database A SQL engine Just Bigtable Wow. That is one big table.
  • 16. App configuration application: appoverflow version: 1 runtime: python api_version: 1 handlers: - url: /.* script: /request.py
  • 17. Request handling class IndexHandler(webapp.RequestHandler): def render_template(self, name, values): path = os.path.join(os.path.dirname(__file__), 'templates', name) self.response.out.write(template.render(path, values)) def get(self): self.render_template('index.html', {}) application = webapp.WSGIApplication([ ('/', IndexHandler), ], debug=True) def main(): run_wsgi_app(application)
  • 18. Demo: Deploying an app In 30 seconds or less. Time me!
  • 19. Demo: Writing App Overflow
  • 20. Adding authentication class IndexHandler(webapp.RequestHandler): def __init__(self): self.user = users.get_current_user() def render_template(self, name, values): url = self.request.url template_values.update({ 'user': self.user, 'login_url':users.create_login_url(url), 'logout_url':users.create_logout_url(url), }) path = os.path.join(os.path.dirname(__file__), 'templates', template_name) self.response.out.write(template.render(path, template_values))
  • 21. Adding authentication <html> <head> <title>{%block title%}App Overflow{%endblock%}</title> {% block head %}{% endblock %} </head> <body> <div class="login"> {% if user %} Logged in as {{user.nickname}} | <a href="{{logout_url}}">Log Out</a> {% else %} <a href="{{login_url}}">Log In</a> {% endif %} </div> {% block body %}{% endblock %} </body> </html>
  • 22. Storing data from google.appengine.ext import db class Question(db.Model): asker = db.UserProperty(required=True) title = db.StringProperty(required=True, indexed=False) body = db.TextProperty(required=True) asked_at = db.DateTimeProperty(auto_now_add=True)
  • 23. Storing data class NewQuestionHandler(BaseHandler): def get(self): self.render_form(forms.QuestionForm()) def post(self): form = forms.QuestionForm(self.request.POST) if not form.is_valid(): self.render_form(form) return entity = models.Question( asker=self.user, **form.clean_data) entity.put() self.redirect('/questions/%d/' % (entity.key().id(),))
  • 24. Fetching data class QuestionHandler(BaseHandler): def get_question(self, id): question = models.Question.get_by_id(int(id)) return question def render_page(self, question): template_values = { 'question': question, } self.render_template('question.html', template_values) def get(self, id): question = self.get_question(id) if question: self.render_page(question)
  • 25. Queries class IndexHandler(BaseHandler): def get_questions(self): q = models.Question.all() q.order('-asked_at') return q.fetch(20) def render_page(self): template_values = { 'questions': self.get_questions(), } self.render_template('index.html', template_values) def get(self): self.render_page()
  • 26. Precomputation class Question(db.Model): asker = db.UserProperty(required=True) title = db.StringProperty(required=True, indexed=False) body = db.TextProperty(required=True) asked_at = db.DateTimeProperty(auto_now_add=True) answer_count = db.IntegerProperty(required=True, default=0) class Answer(db.Model): answerer = db.UserProperty(required=True) body = db.TextProperty(required=True) answered_at = db.DateTimeProperty(auto_now_add=True)
  • 27. Transactions answer = models.Answer( parent=question, answerer=self.user, # ... ) def save_answer(answer): def _tx(): question = db.get(answer.parent().key()) question.answer_count += 1 db.put([answer, question]) return answer.key() return db.run_in_transaction(_tx)
  • 28. XMPP class XmppHandler(xmpp_handlers.CommandHandler): def ask_command(self, message=None): question = models.Question( title=message.arg, body=message.arg, sender=message.sender) question.put() message.reply('Your question has been received. You will be pinged when an answer is submitted.') # Elsewhere... xmpp.send_message([question.sender], 'Answer: ' + answer.body)
  • 29. Additional services / APIs URL Fetch Memcache Mail - incoming and outgoing Images Google Accounts Cron support Task Queue