Google app engine 是否可以在google app engine中托管静态html网站?
如何设置默认根网页的index.htmlGoogle app engine 是否可以在google app engine中托管静态html网站?,google-app-engine,static,Google App Engine,Static,如何设置默认根网页的index.html application: dfischerdna version: 1 runtime: python api_version: 1 handlers: - url: / static_dir: static_files 当访问者输入 然而,我希望当他输入这个时,index.html网页会显示出来。 ->转到404页这可能会对您有所帮助: handlers: - url: / static_files: path/to/in
application: dfischerdna version: 1
runtime: python api_version: 1
handlers:
- url: /
static_dir: static_files
当访问者输入
然而,我希望当他输入这个时,index.html网页会显示出来。
->转到404页这可能会对您有所帮助:
handlers:
- url: /
static_files: path/to/index.html
upload: local/path/to/index.html
- url: /(.+)
static_files: path/to/\1
upload: local/path/to/(.+)
第一个url部分将匹配根url并提供path/to/index.html
。第二个将匹配根路径以外的任何路径,并提供位于请求URI匹配的path/to
下的文件。对于URLhttp://yourapp.appspot.com/index.html
它将提供path/to/index.html
,以及类似http://yourapp.appspot.com/foo/bar.html
它将提供path/to/foo/bar.html
upload指令告诉GAE要上载哪些本地文件作为应用程序实例中的静态文件。使用
static\u files
指令,您还需要提供upload
指令来告诉appcfg.py您要上载哪些文件。如何编写upload指令?@Wobble@unknown Right,我忘了。upload指令的一个示例:handlers:-url:static_files:path/to/index.html static_files:path/to/index.html upload:local/path/to/index.html-url:static_files:path/to/(.+)static_files:path/to/\1 upload:local/path/to/(.+)这在本地上的开发模式下很有效,但当我将它部署到生产环境时,我会得到“未找到处理程序引用的静态文件:“…有什么想法吗?这里可能有什么问题?好主意。这比使用memcache中的字符串生成响应快5倍。”。