SlideShare a Scribd company logo
Google App Engine (GAE)
Wei-Tsung Su (蘇維宗)
ellington.su@gmail.com
06/30/2014 (Ver. 1.0)
Ubiquitous Computing and Ambient Networking Laboratory 1
Change Log
Date Ver. Authors Description
6/30/2014 1.0 Wei-Tsung Su Google App Engine (GAE); GAE for Python; Using Static Files; Google User Service
Ubiquitous Computing and Ambient Networking Laboratory 2
What?
• Google Cloud Platform
– App Engine provides Platform as a Service (PaaS)
– Compute Engine provides Infrastrcture as a Servce (IaaS)
– CloudSQL, Cloud Storage, and Cloud Datastore provide storage options
– BigQuery and Hadoop provide big data processing capability
• Language supported by GAE
– Python, Java, PHP, and GO
– Different languages may provide different features.
Ubiquitous Computing and Ambient Networking Laboratory 3
Why?
• Easily deploy your web services to public
• Seamlessly integrate with other Google services
• Free quotas (https://developers.google.com/appengine/docs/quotas)
– Code & Static Data Store (1GB free)
– Google Cloud Storage (5GB free)
– Blobstore Stored Data (5GB free)
– API access (which depends on different Google API)
– ...
Ubiquitous Computing and Ambient Networking Laboratory 4
How?
• Read Support Documentation
– https://developers.google.com/appengine/
• Try Administration Console
– https://appengine.google.com/
– https://console.developers.google.com
• Download SDK
– https://developers.google.com/appengine/downloads
Start Your Engine
3, 2, 1
Ubiquitous Computing and Ambient Networking Laboratory 5
GAE for Python
Ubiquitous Computing and Ambient Networking Laboratory 6
Setup Development Environment
• Install Python 2.7
– https://www.python.org/download/releases/2.7.7/
• Install App Engine SDK for Python
– https://developers.google.com/appengine/downloads
– Ex. we assume that google_appengine/ is the SDK directory.
• Install Git (optional)
– http://git-scm.com/downloads
Ubiquitous Computing and Ambient Networking Laboratory 7
How GAE for Python Works
• A Python web app interacts with the App Engine web server using
Web Server Gateway Interface (WSGI) protocol.
• WSGI-compatible web application frameworks, such as
– webapp2 (by default, simple)
– Django
– CherryPy
– Pylons
– web.py
– web2py
Ubiquitous Computing and Ambient Networking Laboratory 8
Project Structure of GAE for Python
• Modules
– Dynamic web page generation
– http://webapp-improved.appspot.com/
– Filename: xxx.py (ex. helloword.py)
• Configuration File
– Project configuration
– Routing requests to modules
– https://developers.google.com/appengine/docs/python/config/appconfig
– Filename: app.yaml (壓謀!)
• Ex. we assume that helloworld/ is the project directory
Ubiquitous Computing and Ambient Networking Laboratory 9
Module: helloworld. py
• import webapp2
class MainPage(webapp2.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'text/ html'
self.response.write('Hello, World!')
app = webapp2.WSGIApplication([
('/', MainPage),
], debug=True)
• For security issue, you should disable debug which will display a
stack trace in the browser when a handler raises an exception.
Ubiquitous Computing and Ambient Networking Laboratory 10
Configuration File: app.yaml
• application: your-app-id
version: 1
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /.*
script: helloworld.app
• How to test your project locally
– # google_appengine/dev_appserver.py helloworld/
– Test your web app by visiting the URL: http://localhost:8080
Ubiquitous Computing and Ambient Networking Laboratory 11
Hello, World!
Ubiquitous Computing and Ambient Networking Laboratory 12
Using Static Files
• Sometimes, you may put static files, such images, CSS stylesheets,
JavaScript code, and so on, into your web applications.
• For example,
– <img src="/images/logo.png" >
• Unfortunately, you cannot just
create a directory and put the
static files into the directory.
• You also need to add route into
con figuration file: app.yaml
– - url: /images
static_dir: images
Ubiquitous Computing and Ambient Networking Laboratory 13
Google User Service
• Google user service (https://developers.google.com/appengine/docs/python/users/)
• Import user service module
– from google.appengine.api import users
• Get current user
– user = users.get_current_user() # Google Account, Google Apps Account, OpenID
• Access user information
– user.nickname()
– user.email()
– user.user_id()
• Administrator check
– user.is_current_user_admin()
• Create login/logout pages
– users.create_login_url('[destination URL]')
– users.create_logout_url('[destination URL]')
Ubiquitous Computing and Ambient Networking Laboratory 14
Google User Service - Example
• from google.appengine.api import users
import webapp2
class MainPage(webapp2.RequestHandler):
def get(self):
user = users.get_current_user()
if user:
self.response.headers['Content-Type'] = 'text/ html'
self.response.write('Hello, World, %s!<br>', %(user.nickname()))
self.response.write('<a href="%s">Sign Out</a>'
% users.create_logout_url(self.request.url))
else:
self.redirect(users.create_login_url(self.request.url) )
app = webapp2.WSGIApplication([
('/', MainPage),
], debug=True)
Ubiquitous Computing and Ambient Networking Laboratory 15
Hello, World, User!
Ubiquitous Computing and Ambient Networking Laboratory 16
Deploy Your Application
• Step 1: Create Project in Developer Console
– https://console.developers.google.com
– You will get a random project id (Ex. your-app-id).
– The public URL of your web application will be
• http://your-app-id.appspot.com
• Step 2: Check if the application ID in app.yaml matches your-app-id
– application: your-app-id
• Step 3: Deploy your local project
– #google_appengine/appcfg.py update helloworld/
– Test your web app by visiting the URL: http://your-app-id.appspot.com
Ubiquitous Computing and Ambient Networking Laboratory 17
Q&A
You can clone the sample code by
git clone https://github.com/ucanlab/gae_python_basic_helloworld.git
or visiting
https://github.com/ucanlab/gae_python_basic_helloworld
Ubiquitous Computing and Ambient Networking Laboratory 18

More Related Content

What's hot

Build your application in seconds and optimize workflow as much as you can us...
Build your application in seconds and optimize workflow as much as you can us...Build your application in seconds and optimize workflow as much as you can us...
Build your application in seconds and optimize workflow as much as you can us...
Alex S
 
Tips and tricks for building Large web applications with Drupal
Tips and tricks for building Large web applications with DrupalTips and tricks for building Large web applications with Drupal
Tips and tricks for building Large web applications with Drupal
MitzaCeusan
 
ID Android TechTalk Series #6 : Google Service and Gradle - Anton Nurdin Tuha...
ID Android TechTalk Series #6 : Google Service and Gradle - Anton Nurdin Tuha...ID Android TechTalk Series #6 : Google Service and Gradle - Anton Nurdin Tuha...
ID Android TechTalk Series #6 : Google Service and Gradle - Anton Nurdin Tuha...
Dicoding
 
Deep dive into Vue.js
Deep dive into Vue.jsDeep dive into Vue.js
Deep dive into Vue.js
선협 이
 
introduction to Vue.js 3
introduction to Vue.js 3 introduction to Vue.js 3
introduction to Vue.js 3
ArezooKmn
 
Using and contributing to the next Guice
Using and contributing to the next GuiceUsing and contributing to the next Guice
Using and contributing to the next Guice
Adrian Cole
 
Play Framework on Google App Engine - Productivity Stack
Play Framework on Google App Engine - Productivity StackPlay Framework on Google App Engine - Productivity Stack
Play Framework on Google App Engine - Productivity Stack
Marcin Stepien
 
DrupalGap. How to create native application for mobile devices based on Drupa...
DrupalGap. How to create native application for mobile devices based on Drupa...DrupalGap. How to create native application for mobile devices based on Drupa...
DrupalGap. How to create native application for mobile devices based on Drupa...
DrupalCampDN
 
Introducing the (new) Google Docs API (2019)
Introducing the (new) Google Docs API (2019)Introducing the (new) Google Docs API (2019)
Introducing the (new) Google Docs API (2019)
wesley chun
 
Cloud Function For Firebase - GITS
Cloud Function For Firebase - GITSCloud Function For Firebase - GITS
Cloud Function For Firebase - GITS
Yatno Sudar
 
An Introduction to Django Web Framework
An Introduction to Django Web FrameworkAn Introduction to Django Web Framework
An Introduction to Django Web Framework
David Gibbons
 
Google Web Toolkit
Google Web ToolkitGoogle Web Toolkit
Google Web Toolkit
Michael Angelo Rivera
 
Drupal and diversity of Single sign-on systems
Drupal and diversity of Single sign-on systemsDrupal and diversity of Single sign-on systems
Drupal and diversity of Single sign-on systems
Alex S
 
Improving app performance with Kotlin Coroutines
Improving app performance with Kotlin CoroutinesImproving app performance with Kotlin Coroutines
Improving app performance with Kotlin Coroutines
Hassan Abid
 
Intro to sbt-web
Intro to sbt-webIntro to sbt-web
Intro to sbt-web
Marius Soutier
 
Introduction to Google Cloud Endpoints: Speed Up Your API Development
Introduction to Google Cloud Endpoints: Speed Up Your API DevelopmentIntroduction to Google Cloud Endpoints: Speed Up Your API Development
Introduction to Google Cloud Endpoints: Speed Up Your API Development
Colin Su
 
SenchaCon 2016: Building Enterprise Ext JS Apps with Mavenized Sencha Cmd - F...
SenchaCon 2016: Building Enterprise Ext JS Apps with Mavenized Sencha Cmd - F...SenchaCon 2016: Building Enterprise Ext JS Apps with Mavenized Sencha Cmd - F...
SenchaCon 2016: Building Enterprise Ext JS Apps with Mavenized Sencha Cmd - F...
Sencha
 
Ten practical ways to improve front-end performance
Ten practical ways to improve front-end performanceTen practical ways to improve front-end performance
Ten practical ways to improve front-end performance
Andrew Rota
 
Android - Gradle build optimisation 3d83f31339d239abcc55f869e5f30348?s=47
Android - Gradle build optimisation  3d83f31339d239abcc55f869e5f30348?s=47Android - Gradle build optimisation  3d83f31339d239abcc55f869e5f30348?s=47
Android - Gradle build optimisation 3d83f31339d239abcc55f869e5f30348?s=47
Bartosz Kosarzycki
 
Drupal content automation with migrate 2.6
Drupal content automation with migrate 2.6Drupal content automation with migrate 2.6
Drupal content automation with migrate 2.6
Hector Iribarne
 

What's hot (20)

Build your application in seconds and optimize workflow as much as you can us...
Build your application in seconds and optimize workflow as much as you can us...Build your application in seconds and optimize workflow as much as you can us...
Build your application in seconds and optimize workflow as much as you can us...
 
Tips and tricks for building Large web applications with Drupal
Tips and tricks for building Large web applications with DrupalTips and tricks for building Large web applications with Drupal
Tips and tricks for building Large web applications with Drupal
 
ID Android TechTalk Series #6 : Google Service and Gradle - Anton Nurdin Tuha...
ID Android TechTalk Series #6 : Google Service and Gradle - Anton Nurdin Tuha...ID Android TechTalk Series #6 : Google Service and Gradle - Anton Nurdin Tuha...
ID Android TechTalk Series #6 : Google Service and Gradle - Anton Nurdin Tuha...
 
Deep dive into Vue.js
Deep dive into Vue.jsDeep dive into Vue.js
Deep dive into Vue.js
 
introduction to Vue.js 3
introduction to Vue.js 3 introduction to Vue.js 3
introduction to Vue.js 3
 
Using and contributing to the next Guice
Using and contributing to the next GuiceUsing and contributing to the next Guice
Using and contributing to the next Guice
 
Play Framework on Google App Engine - Productivity Stack
Play Framework on Google App Engine - Productivity StackPlay Framework on Google App Engine - Productivity Stack
Play Framework on Google App Engine - Productivity Stack
 
DrupalGap. How to create native application for mobile devices based on Drupa...
DrupalGap. How to create native application for mobile devices based on Drupa...DrupalGap. How to create native application for mobile devices based on Drupa...
DrupalGap. How to create native application for mobile devices based on Drupa...
 
Introducing the (new) Google Docs API (2019)
Introducing the (new) Google Docs API (2019)Introducing the (new) Google Docs API (2019)
Introducing the (new) Google Docs API (2019)
 
Cloud Function For Firebase - GITS
Cloud Function For Firebase - GITSCloud Function For Firebase - GITS
Cloud Function For Firebase - GITS
 
An Introduction to Django Web Framework
An Introduction to Django Web FrameworkAn Introduction to Django Web Framework
An Introduction to Django Web Framework
 
Google Web Toolkit
Google Web ToolkitGoogle Web Toolkit
Google Web Toolkit
 
Drupal and diversity of Single sign-on systems
Drupal and diversity of Single sign-on systemsDrupal and diversity of Single sign-on systems
Drupal and diversity of Single sign-on systems
 
Improving app performance with Kotlin Coroutines
Improving app performance with Kotlin CoroutinesImproving app performance with Kotlin Coroutines
Improving app performance with Kotlin Coroutines
 
Intro to sbt-web
Intro to sbt-webIntro to sbt-web
Intro to sbt-web
 
Introduction to Google Cloud Endpoints: Speed Up Your API Development
Introduction to Google Cloud Endpoints: Speed Up Your API DevelopmentIntroduction to Google Cloud Endpoints: Speed Up Your API Development
Introduction to Google Cloud Endpoints: Speed Up Your API Development
 
SenchaCon 2016: Building Enterprise Ext JS Apps with Mavenized Sencha Cmd - F...
SenchaCon 2016: Building Enterprise Ext JS Apps with Mavenized Sencha Cmd - F...SenchaCon 2016: Building Enterprise Ext JS Apps with Mavenized Sencha Cmd - F...
SenchaCon 2016: Building Enterprise Ext JS Apps with Mavenized Sencha Cmd - F...
 
Ten practical ways to improve front-end performance
Ten practical ways to improve front-end performanceTen practical ways to improve front-end performance
Ten practical ways to improve front-end performance
 
Android - Gradle build optimisation 3d83f31339d239abcc55f869e5f30348?s=47
Android - Gradle build optimisation  3d83f31339d239abcc55f869e5f30348?s=47Android - Gradle build optimisation  3d83f31339d239abcc55f869e5f30348?s=47
Android - Gradle build optimisation 3d83f31339d239abcc55f869e5f30348?s=47
 
Drupal content automation with migrate 2.6
Drupal content automation with migrate 2.6Drupal content automation with migrate 2.6
Drupal content automation with migrate 2.6
 

Viewers also liked

Using Google App Engine Python
Using Google App Engine PythonUsing Google App Engine Python
Using Google App Engine Python
Akshay Mathur
 
Introduction to Google App Engine with Python
Introduction to Google App Engine with PythonIntroduction to Google App Engine with Python
Introduction to Google App Engine with Python
Brian Lyttle
 
Introduction to Version Control
Introduction to Version ControlIntroduction to Version Control
Introduction to Version Control
Wei-Tsung Su
 
Google Glass - Unit01: Design
Google Glass - Unit01: DesignGoogle Glass - Unit01: Design
Google Glass - Unit01: Design
Wei-Tsung Su
 
創業的藝術
創業的藝術創業的藝術
創業的藝術
Wei-Tsung Su
 
Introduction to OAuth
Introduction to OAuthIntroduction to OAuth
Introduction to OAuth
Wei-Tsung Su
 
軟體系統測試簡介
軟體系統測試簡介軟體系統測試簡介
軟體系統測試簡介
Wei-Tsung Su
 
Arduino Yun Mini - 使用SQLite
Arduino Yun Mini - 使用SQLiteArduino Yun Mini - 使用SQLite
Arduino Yun Mini - 使用SQLite
Wei-Tsung Su
 
Google app engine python
Google app engine   pythonGoogle app engine   python
Google app engine python
Eueung Mulyana
 
Gae icc fall2011
Gae icc fall2011Gae icc fall2011
Gae icc fall2011
Juan Gomez
 
App Engine On Air: Munich
App Engine On Air: MunichApp Engine On Air: Munich
App Engine On Air: Munich
dion
 
Introduccion app engine con python
Introduccion app engine con pythonIntroduccion app engine con python
Introduccion app engine con python
sserrano44
 
App Engine
App EngineApp Engine
App Engine
Loren Davie
 
App Engine for Python Developers
App Engine for Python DevelopersApp Engine for Python Developers
App Engine for Python Developers
Gareth Rushgrove
 
Arduino Yun Mini簡介
Arduino Yun Mini簡介Arduino Yun Mini簡介
Arduino Yun Mini簡介
Wei-Tsung Su
 
LinkIt Smart 7688程式開發
LinkIt Smart 7688程式開發LinkIt Smart 7688程式開發
LinkIt Smart 7688程式開發
Wei-Tsung Su
 
MQTT簡介與使用開放原始碼
MQTT簡介與使用開放原始碼MQTT簡介與使用開放原始碼
MQTT簡介與使用開放原始碼
Wei-Tsung Su
 
Introduction to Wi-Fi Direct
Introduction to Wi-Fi DirectIntroduction to Wi-Fi Direct
Introduction to Wi-Fi Direct
Wei-Tsung Su
 
Introducing MQTT
Introducing MQTTIntroducing MQTT
Introducing MQTT
Andy Piper
 
Introduction to NFC
Introduction to NFCIntroduction to NFC
Introduction to NFC
Wei-Tsung Su
 

Viewers also liked (20)

Using Google App Engine Python
Using Google App Engine PythonUsing Google App Engine Python
Using Google App Engine Python
 
Introduction to Google App Engine with Python
Introduction to Google App Engine with PythonIntroduction to Google App Engine with Python
Introduction to Google App Engine with Python
 
Introduction to Version Control
Introduction to Version ControlIntroduction to Version Control
Introduction to Version Control
 
Google Glass - Unit01: Design
Google Glass - Unit01: DesignGoogle Glass - Unit01: Design
Google Glass - Unit01: Design
 
創業的藝術
創業的藝術創業的藝術
創業的藝術
 
Introduction to OAuth
Introduction to OAuthIntroduction to OAuth
Introduction to OAuth
 
軟體系統測試簡介
軟體系統測試簡介軟體系統測試簡介
軟體系統測試簡介
 
Arduino Yun Mini - 使用SQLite
Arduino Yun Mini - 使用SQLiteArduino Yun Mini - 使用SQLite
Arduino Yun Mini - 使用SQLite
 
Google app engine python
Google app engine   pythonGoogle app engine   python
Google app engine python
 
Gae icc fall2011
Gae icc fall2011Gae icc fall2011
Gae icc fall2011
 
App Engine On Air: Munich
App Engine On Air: MunichApp Engine On Air: Munich
App Engine On Air: Munich
 
Introduccion app engine con python
Introduccion app engine con pythonIntroduccion app engine con python
Introduccion app engine con python
 
App Engine
App EngineApp Engine
App Engine
 
App Engine for Python Developers
App Engine for Python DevelopersApp Engine for Python Developers
App Engine for Python Developers
 
Arduino Yun Mini簡介
Arduino Yun Mini簡介Arduino Yun Mini簡介
Arduino Yun Mini簡介
 
LinkIt Smart 7688程式開發
LinkIt Smart 7688程式開發LinkIt Smart 7688程式開發
LinkIt Smart 7688程式開發
 
MQTT簡介與使用開放原始碼
MQTT簡介與使用開放原始碼MQTT簡介與使用開放原始碼
MQTT簡介與使用開放原始碼
 
Introduction to Wi-Fi Direct
Introduction to Wi-Fi DirectIntroduction to Wi-Fi Direct
Introduction to Wi-Fi Direct
 
Introducing MQTT
Introducing MQTTIntroducing MQTT
Introducing MQTT
 
Introduction to NFC
Introduction to NFCIntroduction to NFC
Introduction to NFC
 

Similar to Google App Engine for Python - Unit01: Basic

Exploring Google APIs with Python
Exploring Google APIs with PythonExploring Google APIs with Python
Exploring Google APIs with Python
wesley chun
 
Infinite Scale - Introduction to Google App Engine
Infinite Scale - Introduction to Google App EngineInfinite Scale - Introduction to Google App Engine
Infinite Scale - Introduction to Google App Engine
Marian Borca
 
File Repository on GAE
File Repository on GAEFile Repository on GAE
File Repository on GAE
lynneblue
 
Powerful Google developer tools for immediate impact! (2023-24 A)
Powerful Google developer tools for immediate impact! (2023-24 A)Powerful Google developer tools for immediate impact! (2023-24 A)
Powerful Google developer tools for immediate impact! (2023-24 A)
wesley chun
 
Google Cloud Platform
Google Cloud Platform Google Cloud Platform
Google Cloud Platform
Francesco Marchitelli
 
Accessing Google Cloud APIs
Accessing Google Cloud APIsAccessing Google Cloud APIs
Accessing Google Cloud APIs
wesley chun
 
Django
DjangoDjango
Google Cloud @ Hackathons (2020)
Google Cloud @ Hackathons (2020)Google Cloud @ Hackathons (2020)
Google Cloud @ Hackathons (2020)
wesley chun
 
Play Framework on Google App Engine
Play Framework on Google App EnginePlay Framework on Google App Engine
Play Framework on Google App Engine
Fred Lin
 
Introduction to App Engine Development
Introduction to App Engine DevelopmentIntroduction to App Engine Development
Introduction to App Engine Development
Ron Reiter
 
Build an AI/ML-driven image archive processing workflow: Image archive, analy...
Build an AI/ML-driven image archive processing workflow: Image archive, analy...Build an AI/ML-driven image archive processing workflow: Image archive, analy...
Build an AI/ML-driven image archive processing workflow: Image archive, analy...
wesley chun
 
Exploring Google (Cloud) APIs & Cloud Computing overview
Exploring Google (Cloud) APIs & Cloud Computing overviewExploring Google (Cloud) APIs & Cloud Computing overview
Exploring Google (Cloud) APIs & Cloud Computing overview
wesley chun
 
Google Cloud lightning talk @MHacks
Google Cloud lightning talk @MHacksGoogle Cloud lightning talk @MHacks
Google Cloud lightning talk @MHacks
wesley chun
 
Google App Engine for PHP
Google App Engine for PHP Google App Engine for PHP
Google App Engine for PHP
Eric Johnson
 
Simple stock market analysis
Simple stock market analysisSimple stock market analysis
Simple stock market analysis
lynneblue
 
Introduction to serverless computing on Google Cloud
Introduction to serverless computing on Google CloudIntroduction to serverless computing on Google Cloud
Introduction to serverless computing on Google Cloud
wesley chun
 
App_Engine_PPT..........................
App_Engine_PPT..........................App_Engine_PPT..........................
App_Engine_PPT..........................
HassamShahid2
 
App_Engine_PPT.ppt
App_Engine_PPT.pptApp_Engine_PPT.ppt
App_Engine_PPT.ppt
Pikachu925105
 
appengine ja night #25 Google App Engine for PHP (English)
appengine ja night #25 Google App Engine for PHP (English)appengine ja night #25 Google App Engine for PHP (English)
appengine ja night #25 Google App Engine for PHP (English)
Ryo Yamasaki
 
App_Engine_PPT.ppt
App_Engine_PPT.pptApp_Engine_PPT.ppt

Similar to Google App Engine for Python - Unit01: Basic (20)

Exploring Google APIs with Python
Exploring Google APIs with PythonExploring Google APIs with Python
Exploring Google APIs with Python
 
Infinite Scale - Introduction to Google App Engine
Infinite Scale - Introduction to Google App EngineInfinite Scale - Introduction to Google App Engine
Infinite Scale - Introduction to Google App Engine
 
File Repository on GAE
File Repository on GAEFile Repository on GAE
File Repository on GAE
 
Powerful Google developer tools for immediate impact! (2023-24 A)
Powerful Google developer tools for immediate impact! (2023-24 A)Powerful Google developer tools for immediate impact! (2023-24 A)
Powerful Google developer tools for immediate impact! (2023-24 A)
 
Google Cloud Platform
Google Cloud Platform Google Cloud Platform
Google Cloud Platform
 
Accessing Google Cloud APIs
Accessing Google Cloud APIsAccessing Google Cloud APIs
Accessing Google Cloud APIs
 
Django
DjangoDjango
Django
 
Google Cloud @ Hackathons (2020)
Google Cloud @ Hackathons (2020)Google Cloud @ Hackathons (2020)
Google Cloud @ Hackathons (2020)
 
Play Framework on Google App Engine
Play Framework on Google App EnginePlay Framework on Google App Engine
Play Framework on Google App Engine
 
Introduction to App Engine Development
Introduction to App Engine DevelopmentIntroduction to App Engine Development
Introduction to App Engine Development
 
Build an AI/ML-driven image archive processing workflow: Image archive, analy...
Build an AI/ML-driven image archive processing workflow: Image archive, analy...Build an AI/ML-driven image archive processing workflow: Image archive, analy...
Build an AI/ML-driven image archive processing workflow: Image archive, analy...
 
Exploring Google (Cloud) APIs & Cloud Computing overview
Exploring Google (Cloud) APIs & Cloud Computing overviewExploring Google (Cloud) APIs & Cloud Computing overview
Exploring Google (Cloud) APIs & Cloud Computing overview
 
Google Cloud lightning talk @MHacks
Google Cloud lightning talk @MHacksGoogle Cloud lightning talk @MHacks
Google Cloud lightning talk @MHacks
 
Google App Engine for PHP
Google App Engine for PHP Google App Engine for PHP
Google App Engine for PHP
 
Simple stock market analysis
Simple stock market analysisSimple stock market analysis
Simple stock market analysis
 
Introduction to serverless computing on Google Cloud
Introduction to serverless computing on Google CloudIntroduction to serverless computing on Google Cloud
Introduction to serverless computing on Google Cloud
 
App_Engine_PPT..........................
App_Engine_PPT..........................App_Engine_PPT..........................
App_Engine_PPT..........................
 
App_Engine_PPT.ppt
App_Engine_PPT.pptApp_Engine_PPT.ppt
App_Engine_PPT.ppt
 
appengine ja night #25 Google App Engine for PHP (English)
appengine ja night #25 Google App Engine for PHP (English)appengine ja night #25 Google App Engine for PHP (English)
appengine ja night #25 Google App Engine for PHP (English)
 
App_Engine_PPT.ppt
App_Engine_PPT.pptApp_Engine_PPT.ppt
App_Engine_PPT.ppt
 

Recently uploaded

Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
Zilliz
 
Public CyberSecurity Awareness Presentation 2024.pptx
Public CyberSecurity Awareness Presentation 2024.pptxPublic CyberSecurity Awareness Presentation 2024.pptx
Public CyberSecurity Awareness Presentation 2024.pptx
marufrahmanstratejm
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
Brandon Minnick, MBA
 
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
alexjohnson7307
 
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
Alex Pruden
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
Jason Packer
 
Azure API Management to expose backend services securely
Azure API Management to expose backend services securelyAzure API Management to expose backend services securely
Azure API Management to expose backend services securely
Dinusha Kumarasiri
 
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Tatiana Kojar
 
System Design Case Study: Building a Scalable E-Commerce Platform - Hiike
System Design Case Study: Building a Scalable E-Commerce Platform - HiikeSystem Design Case Study: Building a Scalable E-Commerce Platform - Hiike
System Design Case Study: Building a Scalable E-Commerce Platform - Hiike
Hiike
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
JavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green MasterplanJavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green Masterplan
Miro Wengner
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 

Recently uploaded (20)

Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
 
Public CyberSecurity Awareness Presentation 2024.pptx
Public CyberSecurity Awareness Presentation 2024.pptxPublic CyberSecurity Awareness Presentation 2024.pptx
Public CyberSecurity Awareness Presentation 2024.pptx
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
 
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
 
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
 
Azure API Management to expose backend services securely
Azure API Management to expose backend services securelyAzure API Management to expose backend services securely
Azure API Management to expose backend services securely
 
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
 
System Design Case Study: Building a Scalable E-Commerce Platform - Hiike
System Design Case Study: Building a Scalable E-Commerce Platform - HiikeSystem Design Case Study: Building a Scalable E-Commerce Platform - Hiike
System Design Case Study: Building a Scalable E-Commerce Platform - Hiike
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
JavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green MasterplanJavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green Masterplan
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 

Google App Engine for Python - Unit01: Basic

  • 1. Google App Engine (GAE) Wei-Tsung Su (蘇維宗) ellington.su@gmail.com 06/30/2014 (Ver. 1.0) Ubiquitous Computing and Ambient Networking Laboratory 1
  • 2. Change Log Date Ver. Authors Description 6/30/2014 1.0 Wei-Tsung Su Google App Engine (GAE); GAE for Python; Using Static Files; Google User Service Ubiquitous Computing and Ambient Networking Laboratory 2
  • 3. What? • Google Cloud Platform – App Engine provides Platform as a Service (PaaS) – Compute Engine provides Infrastrcture as a Servce (IaaS) – CloudSQL, Cloud Storage, and Cloud Datastore provide storage options – BigQuery and Hadoop provide big data processing capability • Language supported by GAE – Python, Java, PHP, and GO – Different languages may provide different features. Ubiquitous Computing and Ambient Networking Laboratory 3
  • 4. Why? • Easily deploy your web services to public • Seamlessly integrate with other Google services • Free quotas (https://developers.google.com/appengine/docs/quotas) – Code & Static Data Store (1GB free) – Google Cloud Storage (5GB free) – Blobstore Stored Data (5GB free) – API access (which depends on different Google API) – ... Ubiquitous Computing and Ambient Networking Laboratory 4
  • 5. How? • Read Support Documentation – https://developers.google.com/appengine/ • Try Administration Console – https://appengine.google.com/ – https://console.developers.google.com • Download SDK – https://developers.google.com/appengine/downloads Start Your Engine 3, 2, 1 Ubiquitous Computing and Ambient Networking Laboratory 5
  • 6. GAE for Python Ubiquitous Computing and Ambient Networking Laboratory 6
  • 7. Setup Development Environment • Install Python 2.7 – https://www.python.org/download/releases/2.7.7/ • Install App Engine SDK for Python – https://developers.google.com/appengine/downloads – Ex. we assume that google_appengine/ is the SDK directory. • Install Git (optional) – http://git-scm.com/downloads Ubiquitous Computing and Ambient Networking Laboratory 7
  • 8. How GAE for Python Works • A Python web app interacts with the App Engine web server using Web Server Gateway Interface (WSGI) protocol. • WSGI-compatible web application frameworks, such as – webapp2 (by default, simple) – Django – CherryPy – Pylons – web.py – web2py Ubiquitous Computing and Ambient Networking Laboratory 8
  • 9. Project Structure of GAE for Python • Modules – Dynamic web page generation – http://webapp-improved.appspot.com/ – Filename: xxx.py (ex. helloword.py) • Configuration File – Project configuration – Routing requests to modules – https://developers.google.com/appengine/docs/python/config/appconfig – Filename: app.yaml (壓謀!) • Ex. we assume that helloworld/ is the project directory Ubiquitous Computing and Ambient Networking Laboratory 9
  • 10. Module: helloworld. py • import webapp2 class MainPage(webapp2.RequestHandler): def get(self): self.response.headers['Content-Type'] = 'text/ html' self.response.write('Hello, World!') app = webapp2.WSGIApplication([ ('/', MainPage), ], debug=True) • For security issue, you should disable debug which will display a stack trace in the browser when a handler raises an exception. Ubiquitous Computing and Ambient Networking Laboratory 10
  • 11. Configuration File: app.yaml • application: your-app-id version: 1 runtime: python27 api_version: 1 threadsafe: true handlers: - url: /.* script: helloworld.app • How to test your project locally – # google_appengine/dev_appserver.py helloworld/ – Test your web app by visiting the URL: http://localhost:8080 Ubiquitous Computing and Ambient Networking Laboratory 11
  • 12. Hello, World! Ubiquitous Computing and Ambient Networking Laboratory 12
  • 13. Using Static Files • Sometimes, you may put static files, such images, CSS stylesheets, JavaScript code, and so on, into your web applications. • For example, – <img src="/images/logo.png" > • Unfortunately, you cannot just create a directory and put the static files into the directory. • You also need to add route into con figuration file: app.yaml – - url: /images static_dir: images Ubiquitous Computing and Ambient Networking Laboratory 13
  • 14. Google User Service • Google user service (https://developers.google.com/appengine/docs/python/users/) • Import user service module – from google.appengine.api import users • Get current user – user = users.get_current_user() # Google Account, Google Apps Account, OpenID • Access user information – user.nickname() – user.email() – user.user_id() • Administrator check – user.is_current_user_admin() • Create login/logout pages – users.create_login_url('[destination URL]') – users.create_logout_url('[destination URL]') Ubiquitous Computing and Ambient Networking Laboratory 14
  • 15. Google User Service - Example • from google.appengine.api import users import webapp2 class MainPage(webapp2.RequestHandler): def get(self): user = users.get_current_user() if user: self.response.headers['Content-Type'] = 'text/ html' self.response.write('Hello, World, %s!<br>', %(user.nickname())) self.response.write('<a href="%s">Sign Out</a>' % users.create_logout_url(self.request.url)) else: self.redirect(users.create_login_url(self.request.url) ) app = webapp2.WSGIApplication([ ('/', MainPage), ], debug=True) Ubiquitous Computing and Ambient Networking Laboratory 15
  • 16. Hello, World, User! Ubiquitous Computing and Ambient Networking Laboratory 16
  • 17. Deploy Your Application • Step 1: Create Project in Developer Console – https://console.developers.google.com – You will get a random project id (Ex. your-app-id). – The public URL of your web application will be • http://your-app-id.appspot.com • Step 2: Check if the application ID in app.yaml matches your-app-id – application: your-app-id • Step 3: Deploy your local project – #google_appengine/appcfg.py update helloworld/ – Test your web app by visiting the URL: http://your-app-id.appspot.com Ubiquitous Computing and Ambient Networking Laboratory 17
  • 18. Q&A You can clone the sample code by git clone https://github.com/ucanlab/gae_python_basic_helloworld.git or visiting https://github.com/ucanlab/gae_python_basic_helloworld Ubiquitous Computing and Ambient Networking Laboratory 18