2010-10-02 68 views
5

在Java中,web.xml可能包含一些<welcome-file>元素。我想在python中做一些相当于没有运气的东西。如何声明app.yaml中的欢迎文件(例如index.html)

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

handlers: 
- url:/
    static_dir: docs 

welcome_files: 
- index.html 

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

回答

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 
+0

这是正确的。 'welcome_file'只存在于Java中,因为Java配置不支持这一点。 – 2010-10-02 14:33:32

+0

Robert,请参阅下面的@Karens'答案并修改你的答案。谢谢! – 2015-09-25 20:11:54

1

罗伯特的回答没有工作了。您必须执行以下操作:

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

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

不能在'upload'中使用regexp'\ 1'。将最后一行更改为'upload:static /.*' – 2015-09-25 20:14:54

0

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

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

- url:/
    static_dir: static