Required Files and Configuration

Your project must contain, at a minimum, the following files:

File and Location Description
/src/<your_api_class>.py The class file (or files, if you implement your API across multiple classes) containing your backend API.
/src/<your_api_server>.py Optional file containing your API server code, if you don't include it inside your API class.
/src/app.yaml The web app deployment descriptor required for App Engine configuration.

The contents of each of these required files is documented in the following sections.

The API class file

The required and optional contents of the class file (or files, if you use a multi-class API) are fully described in the topic Creating an Endpoints API.

The API server file (Optional)

This file and its contents are fully described under Creating an API server.

app.yaml

The bare minimum contents required for this file are as follows:

runtime: python27
threadsafe: true
api_version: 1
basic_scaling:
  max_instances: 2

#[START_EXCLUDE]
skip_files:
- ^(.*/)?#.*#$
- ^(.*/)?.*~$
- ^(.*/)?.*\.py[co]$
- ^(.*/)?.*/RCS/.*$
- ^(.*/)?\..*$
- ^(.*/)?setuptools/script \(dev\).tmpl$
#[END_EXCLUDE]

handlers:
# The endpoints handler must be mapped to /_ah/api.
- url: /_ah/api/.*
  script: main.api

libraries:
- name: pycrypto
  version: 2.6
- name: ssl
  version: 2.7.11

# [START env_vars]
env_variables:
  # The following values are to be replaced by information from the output of
  # 'gcloud endpoints services deploy swagger.json' command.
  ENDPOINTS_SERVICE_NAME: YOUR-PROJECT-ID.appspot.com
  ENDPOINTS_SERVICE_VERSION: 2016-08-01r0
 # [END env_vars]

where:

  • main is the name of the Python module and variable for your API server.
  • threadsafe is set to true if you want App Engine to send multiple requests in parallel, or set to false, if you want App Engine to send requests serially.

Additional but optional settings are available. See the app.yaml reference for more information. However, note that the information under Requiring login or administrator status and Secure URLs do not apply to backend APIs.

Send feedback about...

Cloud Endpoints Frameworks for App Engine