2016-04-24 47 views
2

有人能幫助我(我是新來的YAML):經與YAML和谷歌App Engine的麻煩

application: baking-tutorial 
version: secureable 
runtime: python27 
api_version: 1 
threadsafe: true 

handlers: 

- url: /robots\.txt 
static_files: static/robots.txt 
upload: static/robots\.txt 

- url: /static 
static_dir: static 
secure: optional 

- url: /main\.html 
mime_type: text/html 
static_files: static/\1 
upload: static/main\.html 

- url: /static/.* 
script: mirror.app 
secure: optional 

- url: /.* 
script: mirror2.app 
secure: optional 

基本上我想舉辦一個受密碼保護的網站,所以我有mirror2 .app直接指向你,那麼如果你把它正確的話,JavaScript會將你重定向到main.html,除非它不在那裏。

+0

btw密碼部分工作只是main.html不會出現,它可以在我的電腦上運行,而不是如果我在引擎中運行它 – anonymous

回答

0

您的文件不是正確的YAML文件。你必須注意正確的縮進一切在屬於一起同級別:

application: baking-tutorial 
version: secureable 
runtime: python27 
api_version: 1 
threadsafe: true 

handlers: 

- url: /robots\.txt 
    static_files: static/robots.txt 
    upload: static/robots\.txt 

- url: /static 
    static_dir: static 
    secure: optional 

- url: /main\.html 
    mime_type: text/html 
    static_files: static/\1 
    upload: static/main\.html 

- url: /static/.* 
    script: mirror.app 
    secure: optional 

- url: /.* 
    script: mirror2.app 
    secure: optional 

爲映射鍵「處理」的值是映射的列表。每個後面的映射至少有一個'url'鍵,然後是其他一些。

在YAML中,如果超出前一級別,則基本上會結束前一個構造(序列,映射)。另外請注意,映射值中的列表項的-可以與關鍵字對齊(不需要,它們可以更縮進,只要它們全部縮進相同的級別)。

+0

不,我剛發現問題。在我的html和一些奇怪的代碼中的隨機斜線(昨晚很晚纔開始工作),它的工作原理! – anonymous