如何在app.yaml中声明欢迎文件(例如index.html)

时间:2010-10-02 03:08:12

标签: python google-app-engine configuration yaml

在Java中,web.xml可能包含一些<welcome-file>个元素。我试图在python中做一些相同的事情而没有运气。

application: wk
version: 1
runtime: python
api_version: 1

handlers:
- url: /
  static_dir: docs

welcome_files:
- index.html

有什么想法?我收到一条错误,“welcome_files”未被理解。

3 个答案:

答案 0 :(得分:7)

一种可能性:

application: wk
version: 1
runtime: python
api_version: 1

handlers:
- url: /
  static_files: static/index.html
  upload: static/index.html

- url: /.*
  static_files: static
  upload: static

答案 1 :(得分:1)

罗伯特的回答不再适用。您必须执行以下操作:

- url: /
  static_files: static/index.html
  upload: static/index.html

- url: /(.*)
  static_files: static/\1
  upload: static/\1

答案 2 :(得分:0)

将空字符串路由到index.html。

- url: /$
  static_files: static/index.html
  upload: static/index.html

- url: /
  static_dir: static