This tutorial shows you how to build and run a sample Python application for App Engine and provides a code walkthrough of the sample code. The sample is a simple guestbook that lets users post messages to a public message board.
- Build and test an App Engine app using Python.
- Integrate your application with Google Accounts for user authentication.
- Use the webapp2 framework.
- Use Jinja2 templates.
- Store data in Datastore.
- Deploy your app to App Engine.
App Engine has generous free quotas that will cover your testing this tutorial in a live production environment.
Before you begin
- Create a new Google Cloud console project or retrieve the project ID of
an existing project from the Google Cloud console:
Tip: Retrieve a list of your existing project IDs with gcloud.
Install the Google Cloud CLI and then initialize the gcloud CLI:
Download the SDK
Listing your Google Cloud console project IDs with
From the command line, run:
gcloud projects list
Cloning the project from GitHub
Clone the Guestbook application repository to your local machine:
git clone https://github.com/GoogleCloudPlatform/appengine-guestbook-python.git
Go to the directory that contains the sample code:
Building and running locally
To build and run the sample locally:
Start the local development web server by running the following command from the
python3 CLOUD_SDK_ROOT/bin/dev_appserver.py ./
The development web server runs and listens for requests on port 8080.
Visit http://localhost:8080/ in your web browser to view the app.
Click Login, then sign in with any email address. The development server accepts any email you supply, valid or not. This same code requires a valid Google Account and email when deployed to production.
Stop the development server by pressing Control+C.