SlideShare ist ein Scribd-Unternehmen logo
1 von 30
Downloaden Sie, um offline zu lesen
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?

Weitere Àhnliche Inhalte

Was ist angesagt?

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 DataStacy London
 
AEM Best Practices for Component Development
AEM Best Practices for Component DevelopmentAEM Best Practices for Component Development
AEM Best Practices for Component DevelopmentGabriel Walt
 
Oracle MAF real life OOW.pptx
Oracle MAF real life OOW.pptxOracle MAF real life OOW.pptx
Oracle MAF real life OOW.pptxLuc Bors
 
AEM Sightly Deep Dive
AEM Sightly Deep DiveAEM Sightly Deep Dive
AEM Sightly Deep DiveGabriel 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 exampleAlexander 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 AEMBojana Popovska
 
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 EngineAlexander Zamkovyi
 
Adobe Experience Manager Core Components
Adobe Experience Manager Core ComponentsAdobe Experience Manager Core Components
Adobe Experience Manager Core ComponentsGabriel Walt
 
Three WEM Dev Tricks
Three WEM Dev TricksThree WEM Dev Tricks
Three WEM Dev TricksGabriel Walt
 
Rails engines
Rails enginesRails engines
Rails enginesJosh Schramm
 
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 SAMEric 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/CQNetcetera
 
Creation&imitation
Creation&imitationCreation&imitation
Creation&imitationTae Young Lee
 
Introduction to Sightly and Sling Models
Introduction to Sightly and Sling ModelsIntroduction to Sightly and Sling Models
Introduction to Sightly and Sling ModelsStefano 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 & AuthoringGabriel Walt
 

Was ist angesagt? (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
 

Andere mochten auch

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 salivalesDr. Alan Burgos
 
As cidades (matéria)
As cidades (matéria)As cidades (matéria)
As cidades (matéria)Maria Joao Feio
 
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ùnciapaoolabernardes
 
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çãomcdilolisboa
 
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 baixaJose Bezerra
 
Jornada cientifica 2007 diego silva lemelle
Jornada cientifica 2007 diego silva lemelleJornada cientifica 2007 diego silva lemelle
Jornada cientifica 2007 diego silva lemelleDiego Silva Lemelle
 
ProgramaciĂłn cultural noviembre
ProgramaciĂłn cultural noviembreProgramaciĂłn cultural noviembre
ProgramaciĂłn cultural noviembreboletinmusa
 
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 halloweenSaraHonorio
 
Silvio ibiapino
Silvio ibiapinoSilvio ibiapino
Silvio ibiapinoJanailde
 
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/2012FETAEP
 

Andere mochten auch (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
 

Ähnlich wie Python Ireland Nov 2009 Talk - Appengine

App Engine On Air: Munich
App Engine On Air: MunichApp Engine On Air: Munich
App Engine On Air: Munichdion
 
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) Againjonknapp
 
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 JavaLars 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.jsMek Srunyu Stittri
 
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 appsMichael 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 365Luis 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 EngineTahir 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 Appsdnelson-cs
 
Reactive application using meteor
Reactive application using meteorReactive application using meteor
Reactive application using meteorSapna Upreti
 
Gentle App Engine Intro
Gentle App Engine IntroGentle App Engine Intro
Gentle App Engine Introrobinb123
 
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 AngularJSmurtazahaveliwala
 
Serverless Application Development with SAM
Serverless Application Development with SAMServerless Application Development with SAM
Serverless Application Development with SAMAmazon 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'sAntĂŽ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 APIDavid 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
 

Ähnlich wie 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
 

Mehr von Python Ireland

Async I/O in Python
Async I/O in PythonAsync I/O in Python
Async I/O in PythonPython 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, whatPython 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 PythonPython 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 ProgrammersPython 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 PythonPython 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 environmentPython 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 experiencePython 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 TestingPython 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 DjangoPython 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 PythonPython 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 BoltsPython Ireland
 
Python for cloud computing
Python for cloud computingPython for cloud computing
Python for cloud computingPython Ireland
 
IPython: The awesome python shell
IPython: The awesome python shellIPython: The awesome python shell
IPython: The awesome python shellPython Ireland
 

Mehr von 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
 

KĂŒrzlich hochgeladen

Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Christopher Logan Kennedy
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vĂĄzquez
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 

KĂŒrzlich hochgeladen (20)

Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 

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