Testing and Deploying your Application

Running locally

Run your program locally with the native development tools that you usually use.

For example, you can usually run a Flask application with Flask's development server using:

python main.py

Django applications can be started using:

python manage.py runserver

Running locally with your frameworks development server usually makes it easier to test and debug your application. However, you may wish to run a full WSGI server locally just as App Engine does in production. Typically, you can use the same command specified as entrypoint in your app.yaml, for example:

gunicorn -b :$PORT main:app

Deploying your program

Deploy your app using the gcloud app deploy command. This command automatically builds a container image for you by using the Container Builder service (Beta) before deploying the image to the App Engine flexible environment control plane. The container will include any local modifications you've made to the runtime image.

gcloud app deploy

By default the deploy command automatically generates a new version ID each time that you use it and will route any traffic to the new version.

To override this behavior, you can specify the version ID with the version flag:

gcloud app deploy --version myID

You can also specify not to send all traffic to the new version immediatey with the --no-promote flag:

gcloud app deploy --no-promote

Manually building a container for deployment

To build your container images outside of Google Cloud Platform, you must first upload your images to a container image repository before you can deploy your images to App Engine with the gcloud app deploy command.

For example, if you build your container images locally with Docker, you can push those images to Google Container Registry and then specify the URL of your image in the --image-url flag of the gcloud app deploy command:

gcloud app deploy --image-url gcr.io/my-project-id/my-container-image

Docker base images for Python

If you'd like to build a Python custom runtime application from scratch, you can use these base images in a Dockerfile:

Runtime Docker Command runtime equivalent
Python (2.7, 3.4 can be specified in the Dockerfile) FROM gcr.io/google_appengine/python runtime: python

Send feedback about...

App Engine flexible environment for Python docs