是否可以在谷歌应用引擎中托管静态HTML网站?

Ale*_*lay 3 google-app-engine static

如何为默认根网页设置index.html?

application: dfischerdna version: 1
 runtime: python api_version: 1

 handlers:

 - url: /   
   static_dir: static_files
Run Code Online (Sandbox Code Playgroud)

当访问者键入http://dfischerdna.appspot.com/index.html时,这非常 有用

但是我希望当他输入时,会显示index.html网页. http://dfischerdna.appspot.com/ - >转到404页面

Håv*_*d S 5

这可能对你有用:

handlers:
- url: /
  static_files: path/to/index.html
  upload: local/path/to/index.html
- url: /(.+)
  static_files: path/to/\1
  upload: local/path/to/(.+)
Run Code Online (Sandbox Code Playgroud)

第一个url部分将匹配根URL并提供服务path/to/index.html.第二个将匹配除根路径之外的任何路径,并将提供位于path/to请求URI匹配的文件.对于URL http://yourapp.appspot.com/index.html它将成为path/to/index.html,和一个URL像http://yourapp.appspot.com/foo/bar.html它将有助于path/to/foo/bar.html.

upload指令告诉GAE要上传哪些本地文件作为应用实例中的静态文件.