开发者

Is it possible to host a static html website in google app engine?

How do I set index.html for the default root web page?

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

 handlers:

 - url: /   
   static_dir: static_files

This works great when the visitor types http://dfischerdna.appspot.com/index.html

However I would like that when he types this, the index.html web page would be displayed. http://dfischerdna.appspot.com/ -> goes to 404 p开发者_运维知识库age


This might do the trick for you:

handlers:
- url: /
  static_files: path/to/index.html
  upload: local/path/to/index.html
- url: /(.+)
  static_files: path/to/\1
  upload: local/path/to/(.+)

The first url section will match the root URL and serve path/to/index.html. The second will match any path other than the root path, and will serve the file located under path/to that the request URI matches. For the URL http://yourapp.appspot.com/index.html it will serve path/to/index.html, and for a URL like http://yourapp.appspot.com/foo/bar.html it will serve path/to/foo/bar.html.

The upload directive tells GAE which local files to upload to serve as static files in your app instance.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜