How do you host your website on Google App Engine?

翻译正在进行中。

Google App Engine 是一个功能强大的平台,它能让你在谷歌的infrastructure 上构建并运行应用,你可以在这上面:从头构建多层WEB应用,或建立一个静态网站。

接下来是手把手入门的教程:

Creating a Google Cloud Platform project

To use Google's tools for your own site or app, 你需要在谷歌云平台上创建一个新项目( a new project )   当然,需要谷歌账号。

  1. 打开谷歌云平台控制台(Google Cloud Platform Console),再打开 App Engine dashboard 页面  并点击 Create .
  2. 如果从未创建过项目(project),会提示你是否选择接收邮箱升级,并需要同意团队服务条款才能继续。
  3. 键入项目名,并编辑项目ID(请记下你的项目ID) 
    本教程的示例值:
    • Project Name: GAE Sample Site
    • Project ID: gaesamplesite
  4. 点击Create 以创建工程

创建一个应用(application)

每个云平台项目都可以包含一个APP引擎应用,所以我们来为自己的项目准备一个app

原文:Each Cloud Platform project can contain one App Engine application. Let's prepare an app for our project.

  1. 我们需要一个例子作为应用来发布(need a sample application to publish). 如果你还没有, 请下载 sample app 并解压.
  2. Have a look at the sample application's structure — the website folder contains your website content and app.yaml is your application configuration file.
    • Your website content must go inside the website folder, and its landing page must be called index.html, but apart from that it can take whatever form you like.
    • The app.yaml file is a configuration file that tells App Engine how to map URLs to your static files. You don't need to edit it.

Publishing your application

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

  1. 打开Google Cloud Shell.
  2. 把目录拖拽到代码编辑器左边
    原文:Drag and drop the sample-app folder into the left pane of the code editor.
  3. 在命令行中键入如下命令选择你的项目:
    gcloud config set project gaesamplesite
  4. 键入如下命令 进入到 app的 目录:
    cd sample-app
  5. You are now ready to deploy your application, i.e. upload your app to App Engine:
    gcloud app deploy
  6. Enter a number to choose the region where you want your application located.
  7. 键入 Y 确认.
  8. 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.

更多信息

请访问Google App Engine Documentation.

文档标签和贡献者

此页面的贡献者: mdnwebdocs-bot, sky5454
最后编辑者: mdnwebdocs-bot,