Building Websites on Google Cloud

Mohammad Tayseer
http://mtayseer.net
http://github.com/mtayseer
http://toddbacile.wordpress.com/2013/10/09/a-blog-the-path-to-a-social-media-job/

Boooooooooring

http://www.sydneysiderblog.com/?p=557

Demo

What is Cloud Computing?

Why Google?

Webapps on Google AppEngine

  1. Application
  2. Request handlers
  3. Templates
  4. Data store

class Garbage(ndb.Model):
    name = ndb.StringProperty(indexed=True)
    date = ndb.DateTimeProperty(auto_now_add=True)
    author = ndb.UserProperty()
    position = ndb.GeoPtProperty()

class MainPage(webapp2.RequestHandler):
    def get(self):
    	self.response.write('Hello, world')
        template = JINJA_ENVIRONMENT.get_template('home.html')
        self.response.write(template.render({'user': 'Mohammad'}))


application = webapp2.WSGIApplication([
    ('/', MainPage),
], debug=True)

Jinja2 templates


{% if user %}
    Hello, <b>{{ user }}</b> 
    <button>Add new gargage marker</button>
{% else %}
    Please <b><a href="{{ login_url }}">Login with Google</a></b> 
{% endif %}
            	

YAML configurations


application: your-app-id
version: 1
runtime: python27
api_version: 1
threadsafe: true

handlers:
- url: /static/*
  static_dir: static

- url: /.*
  script: garbage_map.application

libraries:
- name: webapp2
  version: latest

Interactive console

Datastore viewer

Thanks