开发者

Google App Engine: lose CSS on deployment?

I 开发者_高级运维have a Google App Engine app that works fine on the dev server. However, when I upload it, the CSS is gone. The scripts are still there, however.

From app.yaml:

- url: /scripts
  static_dir: Static/Scripts

- url: /styles
  static_dir: Static/styles

From the base template:

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

What could be causing this? Am I doing something wrong?


The URL you're serving by specifying - url: /scripts is going to be something like http://foobar.appspot.com/scripts. The URL you're requesting, given that you chose to use href="./styles/style.css", will be the same only for top-level pages -- if you have that header on, say, http://foobar.appspot.com/good/grief, then you'll be requesting your styles from http://foobar.appspot.com/good/styles/style.css and the like. Why would you want that?! Use href="/styles/style.css", without that extremely peculiar leading dot, and you'll be requesting the style from http://foobar.appspot.com/styles/style.css -- which looks to be where you want to be serving it from -- whatever page on foobar.appspot.com you request it from.


In addition to Alex's answer, I note you seem to be using capitalization inconsistently - some first letters are capitalized, and others aren't. Bear in mind that while Windows is not case-insensitive, most platforms are case-sensitive - so if you weren't strict about using the same capitalization for the same name everywhere, when you deploy, you will get a lot of 404s in place of expected files.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜