# App Engine Python Overview - Google App Engine - Google Code

English ▼
Skip to page content Skip to main navigation
e.g. "templates" or "datastore"

# App Engine Python Overview

Welcome to Google App Engine for Python! With App Engine, you can build web applications using the Python programming language, and take advantage of the many libraries, tools and frameworks for Python that professional developers use to build world-class web applications. Your Python application runs on Google's scalable infrastructure, and uses large-scale persistent storage and services.

If you haven't already, see the Python Getting Started Guide for an interactive introduction to developing web applications with Python and Google App Engine.

### The Python Runtime Environment

A Python web app interacts with the App Engine web server using the CGI protocol. An app can use a WSGI-compatible web application framework using a CGI adapter. App Engine includes a simple web application framework, called webapp, to make it easy to get started. For larger applications, mature third-party frameworks, such as Django, work well with App Engine.

App Engine supports Python 2.5. The Python interpreter runs in a secured "sandbox" environment to isolate your application for service and security. The interpreter can run any Python code, including Python modules you include with your application, as well as the Python standard library. The interpreter cannot load Python modules with C code; it is a "pure" Python environment.

The sandbox ensures that apps can only perform actions that do not interfere with the performance and scalability of other apps. For instance, an app cannot write data to the local file system or make arbitrary network connections. Instead, apps use scalable services provided by App Engine to store data and communicate over the Internet. The Python interpreter raises an exception when an app attempts to import a module from the standard library known to not work within the sandbox restrictions.

See CGI Environment for more information.

### The Datastore and Services

Apps can use the App Engine Datastore for reliable, scalable persistent storage of data. The Python API to the App Engine datastore includes rich data modeling tools for managing data schemas. The API supports two interfaces for performing datastore queries, including GQL, a SQL-like query language that is also used in the Admin Console.

The App Engine Memcache provides fast, transient distributed storage for caching the results of datastore queries and calculations. The Python interface to the App Engine memcache is compatible with the Python Memcached API.

Apps use the URL Fetch service to access resources over the web, and to communicate with other hosts using the HTTP and HTTPS protocols. Python applications can use the urllib, urllib2, or httplib modules from the Python standard library to access this service, or they can use the App Engine URL Fetch service API.

An app can use the Mail service to send email messages on behalf of the application's administrators, or on behalf of the currently signed in user.

The Images service lets applications transform and manipulate image data in several formats, including cropping, rotating, resizing, and photo color enhancement.

An application can use Google Accounts for user authentication. Google Accounts handles user account creation and sign-in, and a user that already has a Google account (such as a GMail account) can use that account with your app. An app can detect when the current user is signed in, and can access the user's email address. The Python API can return user data in an object that can be stored directly in the datastore.

### Scheduled Tasks

An application can configure scheduled tasks that will call URLs of the application at specified intervals. For more on this, see Cron Jobs.

### Python Tools

The App Engine Python SDK includes tools for testing your application, uploading your application files, managing datastore indexes, downloading log data, and uploading large amounts of data to the datastore.

The development server runs your application on your local computer for testing your application. The server simulates the App Engine datastore, services and sandbox restrictions. The development server can also generate configuration for datastore indexes based on the queries the app performs during testing.

A multipurpose tool called appcfg.py handles all command-line interaction with your application running on App Engine. `appcfg.py` can upload your application to App Engine, or just update the datastore index configuration so you can build new indexes before updating the code. It can also download the app's log data, so you can analyze your app's performance using your own tools.

The Python SDK includes a data upload tool that can add data to your app's datastore from your local data files. The tool can extract data from CSV files, a spreadsheet format supported by most spreadsheet software such as Google Docs or Microsoft Excel. You can customize how CSV files are converted into datastore entities using Python code.