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

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

DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 

Kürzlich hochgeladen (20)

DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 

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