Python for Google App Engine

Book description

Master the full range of development features provided by Google App Engine to build and run scalable web applications in Python

In Detail

Google App Engine is a key component of the Google Cloud Platform and one of the most comprehensive cloud services. Together with Python, the first programming language ever supported by the platform, Google App Engine favors rapid development, significantly contributing to the success of your projects.

This book will guide you through the Google Cloud Platform starting from the basics all the way through successfully designing, building, and running modern and scalable web applications in Python with Google App Engine. From authentication to data storage, and from asynchronous jobs to server push techniques, you will learn how to use services such as datastore, cloud storage, Cloud SQL, task queues and channels in a Python application based on web frameworks such as Webapp2 and Django. As the topics in this book are covered in a step-by-step fashion, you will get to grips with the information quickly and easily.

What You Will Learn

  • Persist and manage data in the cloud datastore with the NDB Python API

  • Run asynchronous tasks with task queue and Cron

  • Set up, use, and manage a MySQL server instance on Cloud SQL

  • Employ channels to develop real-time applications with push notifications from the server

  • Write a complete Django application using Cloud SQL as the data backend

  • Use cloud endpoints to rapidly provide REST APIs for your mobile clients

  • Table of contents

    1. Python for Google App Engine
      1. Table of Contents
      2. Python for Google App Engine
      3. Credits
      4. About the Author
      5. About the Reviewers
      6. www.PacktPub.com
        1. Support files, eBooks, discount offers, and more
          1. Why subscribe?
          2. Free access for Packt account holders
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
        7. Downloading the example code
          1. Downloading the color images of this book
        8. Errata
        9. Piracy
        10. Questions
      8. 1. Getting Started
        1. The cloud computing stack – SaaS, PaaS, and IaaS
        2. Google Cloud Platform
          1. Hosting + Compute
          2. Storage
          3. BigQuery
          4. Services
        3. What Google App Engine does
          1. The runtime environment
          2. The services
        4. Making our first Python application
          1. Download and installation
            1. Installing on Windows
            2. Installing on Mac OS X
            3. Installing on Linux
          2. App Engine Launcher
          3. Creating the application
            1. The app.yaml configuration file
            2. The main.py application script
          4. Running the development server
          5. Uploading the application to App Engine
        5. Google Developer Console
          1. Development Console
        6. Summary
      9. 2. A More Complex Application
        1. Experimenting on the Notes application
        2. Authenticating users
        3. HTML templates with Jinja2
        4. Handling forms
        5. Persisting data in Datastore
          1. Defining the models
          2. Basic querying
          3. Transactions
        6. Using static files
        7. Summary
      10. 3. Storing and Processing Users' Data
        1. Uploading files to Google Cloud Storage
          1. Installing Cloud Storage Client Library
          2. Adding a form to upload images
          3. Serving files from Cloud Storage
          4. Serving files through Google's Content Delivery Network
            1. Serving images
            2. Serving other types of files
        2. Transforming images with the Images service
        3. Processing long jobs with the task queue
        4. Scheduling tasks with Cron
        5. Sending notification e-mails
        6. Receiving users' data as e-mail messages
        7. Summary
      11. 4. Improving Application Performance
        1. Advanced use of Datastore
          1. More on properties – arrange composite data with StructuredProperty
          2. More on queries – save space with projections and optimize iterations with mapping
            1. Projection queries
            2. Mapping
          3. NDB asynchronous operations
          4. Caching
          5. Backup and restore functionalities
          6. Indexing
        2. Using Memcache
        3. Breaking our application into modules
        4. Summary
      12. 5. Storing Data in Google Cloud SQL
        1. Creating a Cloud SQL instance
          1. Configuring access
          2. Setting the root password
        2. Connecting to the instance with the MySQL console
          1. Creating the notes database
          2. Creating a dedicated user
          3. Creating tables
        3. Connecting to the instance from our application
        4. Loading and saving data
        5. Using the local MySQL installation for development
        6. Summary
      13. 6. Using Channels to Implement a Real-time Application
        1. Understanding how the Channel API works
        2. Making our application real time
        3. Implementing the server
          1. The JavaScript code for clients
        4. Tracking connections and disconnections
        5. Summary
      14. 7. Building an Application with Django
        1. Setting up the local environment
          1. Configuring a virtual environment
          2. Installing dependencies
        2. Rewriting our application using Django 1.7
          1. Using Google Cloud SQL as a database backend
          2. Creating a reusable application in Django
          3. Views and templates
          4. Authenticating users with Django
          5. Using the ORM and migrations system
          6. Processing forms with the Forms API
          7. Uploading files to Google Cloud Storage
        3. Summary
      15. 8. Exposing a REST API with Google Cloud Endpoints
        1. Reasons to use a REST API
        2. Designing and building the API
          1. Resources, URLs, HTTP verbs, and response code
          2. Defining resource representations
        3. Implementing API endpoints
        4. Testing the API with API Explorer
        5. Protecting an endpoint with OAuth2
        6. Summary
      16. Index

    Product information

    • Title: Python for Google App Engine
    • Author(s): Massimiliano Pippi
    • Release date: January 2015
    • Publisher(s): Packt Publishing
    • ISBN: 9781784398194