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.
- Go to the Google Cloud Platform Console and select Select a project > Create an empty project.
- Enter a name for the project, and make a note of your project (application) ID somewhere safe (you can edit it if you like.)
- 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.
- We'll need a sample website to publish. If you've not got one to use, download and unzip this sample application.
- Have a look at the sample application's structure — the
static
folder contains your website content andapp.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 theapplication
field, the value of which should be changed fromyour-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.)
- Your website must go inside the static folder, and its landing page must be called
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.
- 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.
- 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.
- 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. - Click File > Add Existing Application > Browse, select your sample app's root folder, then select Add to add it to the launcher.
- Select the sample app and click the Run button then the Browse button to test your app locally.
- 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 theapp.yaml
file in your default text editor, at which point you can edit it appropriately (changeyour-project-id
to your actual real project ID) then save and close it. - Your real project ID should now be listed in the Name column in the launcher app.
- 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.
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.