2010-04-09 110 views
2

我有一個適用於開發服務器的Google App Engine應用程序。但是,當我上傳它時,CSS就消失了。但是,腳本仍然存在。Google App Engine:部署失去CSS?

app.yaml

- url: /scripts 
    static_dir: Static/Scripts 

- url: /styles 
    static_dir: Static/styles 

從基本模板:

<head> 
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> 
    <script type="text/javascript" src="./scripts/JQuery.js"></script> 
    <script type="text/javascript" src="./scripts/sprintf.js"></script> 
    <link rel="stylesheet" href="./styles/style.css" type="text/css" media="screen" /> 
</head> 

可能是什麼造成的?難道我做錯了什麼?

回答

5

通過指定- url: /scripts將服務的URL將是類似http://foobar.appspot.com/scripts。您要求請求的網址(假設您選擇使用href="./styles/style.css")僅適用於頂級網頁 - 如果您有該標頭,例如http://foobar.appspot.com/good/grief,那麼您將要求您的樣式從http://foobar.appspot.com/good/styles/style.css等等。你爲什麼要想要那個?!使用href="/styles/style.css",如果沒有那個非常奇怪的前導點,並且您將要求http://foobar.appspot.com/styles/style.css的風格 - 這看起來就是您想要從中提供的風格 - 無論您要求從哪個頁面獲得foobar.appspot.com

0

除了Alex的回答,我注意到你似乎不一致地使用大寫字母 - 一些首字母大寫,其他字母不大。請記住,雖然Windows不區分大小寫,但大多數平臺都區分大小寫 - 所以如果你不嚴格地使用相同的大寫字母來替換相同的名字,那麼當你部署時,你將會獲得大量的404s期望的文件。

相關問題