You can use custom runtimes to add
additional functionality to a Python app running in the flexible environment. To configure
a custom runtime, you replace this line in your
with this line:
You must also add a Dockerfile in the same directory that contains the
For building Python containers, Google provides these base images:
|Base Image||Version||Health Checks||Supports App Engine APIs||Notes|
||Python2.7||Yes||Yes||This is the same image used when you specify
||Python2.7/3.4||No||No||This is the same image used when you specify
You can automatically generate the
Dockerfile for your current runtime using
gcloud beta app gen-config --custom
App Engine API support
A base image that supports the App Engine APIs supports 7 APIs in the standard (
runtime: python27) App Engine runtime.
By default, all programs running in the flexible environment receive health check requests If a base image supports health checking, you don't need to write any additional code. If it does not, you will need to disable health checks, or write your own code to handle health check requests.
Selecting the Python version
python runtime has Python 2.7.10 and Python 3.4 pre-installed. You can customize the
Dockerfile to install other versions or alternative interpreters if needed.
You can specify a whether to use Python 2 or Python 3 in your application's
Dockerfile when creating the virtualenv:
# Python 3 RUN virtualenv /env -p python3.4 # Python 2 (implicit) RUN virtualenv /env # Python 2 (explicit) RUN virtualenv /env -p python2.7