How do you host your website on Google App Engine?

Google App Engine is a powerful platform that lets you build and run applications on Google’s infrastructure — whether you need to build a multi-tiered web application from scratch or host a static website. Here's a step-by-step guide to hosting your website on Google App Engine.

Creating a Google Cloud Platform project

To use Google's tools for your own site or app, you need to create a new project on Google's Cloud Platform. This requires having a Google account.

  1. Go to the Google Cloud Platform Console and select Select a project > Create an empty project.
  2. Enter a name for the project, and make a note of your project (application) ID somewhere safe (you can edit it if you like.)
  3. If you've not created a project before, you'll need to select whether you want to receive email updates or not, agree to the Terms of Service, then you should be able to press the Create button to create your project.
  4. We'll need a sample website to publish. If you've not got one to use, download and unzip this sample application.
  5. Have a look at the sample application's structure — the static folder contains your website content and app.yaml is your application configuration file.
    • Your website must go inside the static folder, and its landing page must be called index.html, but apart from that it can take whatever form you like.
    • Your app.yaml file needs to be edited, but don't worry — it's a very simple file. You don't need to change anything in it except for the application field, the value of which should be changed from your-project-id to your actual real project ID that you saved earlier (you can also do this via the Google App Engine Launcher, as we'll see later.)

Installing the necessary tools

The tool we'll be using — Google App Engine SDK — can be used with various different coding environments. We'll use it with Python for this tutorial.

  1.   Make sure Python 2.7.x is installed on your computer. Here is a setup guide to installing Python on Windows; Mac OS X and most common flavors of Linux come with Python 2.7 already installed.
  2. Download and install Google App Engine SDK for Python.

Publishing your app

Now we've got our project made, sample app files collected together and tools installed, let's publish our app.

  1. Open the GoogleAppEngineLauncher application. It may ask you if you want to make command symlinks. This is a good idea, so click yes.
     
    Note: If the launcher application fails to find Python, you can configure its location by editing the launcher preferences: click the Edit menu > Preferences, and set Python Path to the location where Python was installed. For example on Windows it will be C:\Python27\pythonw.exe if you have installed Python into the default directory C:\Python27.
  2. Click File > Add Existing Application > Browse, select your sample app's root folder, then select Add to add it to the launcher.
  3. Select the sample app and click the Run button then the Browse button to test your app locally.
  4. If you're happy with the result, you are now ready to deploy it. If you've not already added your project ID to your app.yaml configuration file, click the Edit button now — this will open up the app.yaml file in your default text editor, at which point you can edit it appropriately (change your-project-id to your actual real project ID) then save and close it.
  5. Your real project ID should now be listed in the Name column in the launcher app.
  6. Now press the Deploy button to deploy it. A web browser window should open, and you'll be taken few a few authentication steps in the Google services, such as choosing your Google account. Eventually you'll get a success message.

    GAE Launcher

    Now navigate your browser to your-project-id.appspot.com to see your website online. For example, for the project ID gaesamplesite, go to gaesamplesite.appspot.com.

See also

To learn more, see Google App Engine Docs.

Document Tags and Contributors

 Contributors to this page: Mori
 Last updated by: Mori,