Part I: Deploying a Basic Application

Set up & deploy first application locally and via GAE. GCP instructions. And code mixed with example GCP code.

A: Creating the project

  • Setup a GCP account & install gcloud SDK & connect.
  • Authorize gcloud to access the Cloud Platform with Google user credentials. The command below will redirect you to your browser to login. gcloud auth login
  • Create a project (dashboard->new project [drop down])
  • Your local python interpreter matters when using gcloud; create separate env for clean env (see below).
  • Create gcloud config from terminal: gcloud config configurations create CONFIGURATION_NAME
  • Set project name (eg project Project ID): gcloud config set < property > < PROPERTY >
  • Create a credentials file via a services account, download key, and export path (all instructions here).
  • Enable the Cloud Build API.

B: Code inspection & run locally

  • Environment Set up: create virtual env and activate:
    virtualenv < name >
    source < name >/bin/activate
    pip install -r requirements.txt
  • Web Service Structure
    • building-an-app/ {app.yaml,, requirements.txt}
    • static/{script.js, style.css}
    • templates/{index.html}
    • Jinja-based HTML template
    • Edit index file to include your name
  • Run locally:
    • Terminal: python
    • Go to host domain

C: Deploying Web Service

  • Create app engine, deploy app engine, and view (command line or
    gcloud app create;gcloud app deploy;gcloud app browse
  • By default, the gcloud app deploy command deploys only the app.yaml file in your current directory. Whenever you run this command, App Engine generates a unique ID for the version that you deploy, deploys the version to the Cloud project you configured the gcloud tool to use, and routes all traffic to the new version. The new version becomes the default version.
  • Congratulations! You've deployed an App!