O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Programming Google App Engine

Book Description

As one of today's cloud computing services, Google App Engine does more than provide access to a large system of servers. It also offers you a simple model for building applications that scale automatically to accommodate millions of users. With Programming Google App Engine, you'll get expert practical guidance that will help you make the best use of this powerful platform. Google engineer Dan Sanderson shows you how to design your applications for scalability, including ways to perform common development tasks using App Engine's APIs and scalable services.

You'll learn about App Engine's application server architecture, runtime environments, and scalable datastore for distributing data, as well as techniques for optimizing your application. App Engine offers nearly unlimited computing power, and this book provides clear and concise instructions for getting the most from it right from the source.

  • Discover the differences between traditional web development and development with App Engine
  • Learn the details of App Engine's Python and Java runtime environments
  • Understand how App Engine handles web requests and executes application code
  • Learn how to use App Engine's scalable datastore, including queries and indexes, transactions, and data modeling
  • Use task queues to parallelize and distribute work across the infrastructure
  • Deploy and manage applications with ease

Table of Contents

  1. Dedication
  2. Preface
    1. Using This Book
    2. Conventions Used in This Book
    3. Using Code Samples
    4. Safari® Books Online
    5. How to Contact Us
    6. Acknowledgments
  3. 1. Introducing Google App Engine
    1. The Runtime Environment
    2. The Static File Servers
    3. The Datastore
      1. Entities and Properties
      2. Queries and Indexes
      3. Transactions
    4. The Services
    5. Google Accounts
    6. Task Queues and Cron Jobs
    7. Developer Tools
    8. The Administration Console
    9. Things App Engine Doesn’t Do...Yet
    10. Getting Started
  4. 2. Creating an Application
    1. Setting Up the SDK
      1. Installing the Python SDK
        1. A brief tour of the Launcher
      2. Installing the Java SDK
        1. Java on Mac OS X
        2. Installing the Java SDK with the Google Plugin for Eclipse
        3. Installing the Java SDK without Eclipse
    2. Developing the Application
      1. The User Preferences Pattern
      2. Developing a Python App
        1. Introducing the webapp framework
        2. Users and Google Accounts
        3. Web forms and the datastore
        4. Caching with memcache
      3. Developing a Java App
        1. Users and Google Accounts
        2. Web forms and the datastore
        3. Caching with memcache
      4. The Development Console
    3. Registering the Application
      1. The Application ID and Title
      2. Setting Up a Domain Name
      3. Google Apps and Authentication
    4. Uploading the Application
    5. Introducing the Administration Console
  5. 3. Handling Web Requests
    1. The App Engine Architecture
    2. Configuring the Frontend
      1. Configuring a Python App
        1. Runtime versions
      2. Configuring a Java App
      3. Domain Names
      4. App IDs and Versions
        1. App IDs and versions in Python
        2. App IDs and versions in Java
      5. Request Handlers
        1. Request handlers in Python
        2. Request handlers in Java
          1. JavaServer Pages (JSPs)
      6. Static Files and Resource Files
        1. Static files in Python
          1. MIME types
          2. Cache expiration
        2. Static files in Java
      7. Secure Connections
        1. Secure connections in Python
        2. Secure connections in Java
      8. Authorization with Google Accounts
        1. Authorization in Python
        2. Authorization in Java
    3. How the App Is Run
      1. The Python Runtime Environment
      2. The Java Runtime Environment
      3. The Sandbox
        1. The Python sandbox
        2. The Java sandbox
      4. App Caching
        1. App caching in Python
        2. App caching in Java
      5. Logging
        1. Logging in Python
        2. Logging in Java
    4. Quotas and Limits
      1. Request Limits
      2. CPU Limits
      3. Service Limits
      4. Deployment Limits
      5. Billable Quotas
      6. Resource Usage Headers
  6. 4. Datastore Entities
    1. Entities, Keys, and Properties
    2. Introducing the Python Datastore API
    3. Introducing the Java Datastore API
    4. Property Values
      1. Strings, Text, and Blobs
      2. Unset Versus the Null Value
      3. Multivalued Properties
    5. Keys and Key Objects
    6. Using Entities
      1. Getting Entities Using Keys
      2. Inspecting Entity Objects
      3. Saving Entities
      4. Deleting Entities
  7. 5. Datastore Queries
    1. Queries and Kinds
    2. Query Results and Keys
    3. GQL
    4. The Python Query API
      1. The Query Class
      2. GQL in Python
      3. Retrieving Results
      4. Keys-Only Queries
    5. The Java Query API
      1. Keys-Only Queries in Java
    6. Introducing Indexes
    7. Automatic Indexes and Simple Queries
      1. All Entities of a Kind
      2. One Equality Filter
      3. Greater-Than and Less-Than Filters
      4. One Sort Order
      5. Queries on Keys
      6. Kindless Queries
    8. Custom Indexes and Complex Queries
      1. Multiple Sort Orders
      2. Filters on Multiple Properties
      3. Multiple Equality Filters
    9. Not-Equal and IN Filters
    10. Unset and Nonindexed Properties
    11. Sort Orders and Value Types
    12. Queries and Multivalued Properties
      1. A Simple Example
      2. MVPs in Python
      3. MVPs and Equality Filters
      4. MVPs and Inequality Filters
      5. MVPs and Sort Orders
      6. Exploding Indexes
    13. Configuring Indexes
      1. Index Configuration for Python
      2. Index Configuration for Java
  8. 6. Datastore Transactions
    1. Entities and Entity Groups
      1. Keys, Paths, and Ancestors
      2. Ancestor Queries
    2. What Can Happen in a Transaction
      1. Transactional Reads
    3. Transactions in Python
    4. Transactions in Java
    5. How Entities Are Updated
    6. How Entities Are Read
    7. Batch Updates
    8. How Indexes Are Updated
  9. 7. Data Modeling with Python
    1. Models and Properties
    2. Property Declarations
      1. Property Value Types
      2. Property Validation
      3. Nonindexed Properties
      4. Automatic Values
      5. List Properties
      6. Models and Schema Migration
    3. Modeling Relationships
      1. One-to-Many Relationships
      2. One-to-One Relationships
      3. Many-to-Many Relationships
        1. The key list method
        2. The link model method
    4. Model Inheritance
    5. Queries and PolyModels
    6. Creating Your Own Property Classes
      1. Validating Property Values
      2. Marshaling Value Types
      3. Customizing Default Values
      4. Accepting Arguments
  10. 8. The Java Persistence API
    1. Setting Up JPA
    2. Entities and Keys
    3. Entity Properties
    4. Embedded Objects
    5. Saving, Fetching, and Deleting Objects
    6. Transactions in JPA
    7. Queries and JPQL
    8. Relationships
    9. For More Information
  11. 9. The Memory Cache
    1. The Python Memcache API
      1. Setting and Getting Values in Python
      2. Setting and Getting Multiple Values
      3. Memcache Namespaces
      4. Cache Expiration
      5. Deleting Keys
      6. Memcache Counters
      7. Cache Statistics
    2. The Java Memcache API
  12. 10. Fetching URLs and Web Resources
    1. Fetching URLs in Python
    2. Fetching URLs in Java
    3. Asynchronous Requests in Python
      1. RPC Objects
      2. Processing Results with Callbacks
  13. 11. Sending and Receiving Mail and Instant Messages
    1. Enabling Inbound Services
    2. Sending Email Messages
      1. Sender Addresses
      2. Recipients
      3. Attachments
      4. Sending Email in Python
      5. Sending Email in Java
    3. Receiving Email Messages
      1. Receiving Email in Python
      2. Receiving Email in Java
    4. Sending XMPP Messages
      1. Sending a Chat Invitation
      2. Sending a Chat Message
      3. Checking a Google Talk User’s Status
    5. Receiving XMPP Messages
      1. Receiving XMPP Messages in Python
      2. Receiving XMPP Messages in Java
  14. 12. Bulk Data Operations and Remote Access
    1. Setting Up the Remote API for Python
    2. Setting Up the Remote API for Java
    3. Using the Bulk Loader Tool
      1. Installing SQLite
      2. Backup and Restore
      3. Uploading Data
      4. Downloading Data
      5. Controlling the Bulk Loader
    4. Using the Remote Shell Tool
    5. Using the Remote API from a Script
  15. 13. Task Queues and Scheduled Tasks
    1. Task Queues
      1. Processing Rates and Token Buckets
      2. Elements of a Task
      3. Task Handlers and Retries
      4. Testing and Managing Tasks
      5. Using Task Queues in Python
        1. Deferring work with tasks
      6. Using Task Queues in Java
      7. Transactional Task Enqueueing
    2. Scheduled Tasks
  16. 14. The Django Web Application Framework
    1. Installing Django
    2. Creating a Django Project
    3. The Request Handler Script
    4. The Django App Engine Helper
    5. Creating a Django Application
    6. Using App Engine Models With Django
    7. Using Django Unit Tests and Fixtures
    8. Using Django Forms
  17. 15. Deploying and Managing Applications
    1. Uploading an Application
    2. Using Versions
    3. Managing Service Configuration
    4. Managing Indexes
    5. Browsing and Downloading Logs
    6. Inspecting the Datastore
    7. Application Settings
    8. Managing Developers
    9. Quotas and Billing
    10. Getting Help
  18. Index
  19. About the Author
  20. Colophon
  21. Copyright