Google App Engine:在部署时丢失CSS?

Nic*_*ner 2 google-app-engine

我有一个Google App Engine应用程序,可以在开发服务器上正常运行.但是,当我上传它时,CSS就消失了.但是,脚本仍在那里.

来自app.yaml:

- url: /scripts
  static_dir: Static/Scripts

- url: /styles
  static_dir: Static/styles
Run Code Online (Sandbox Code Playgroud)

从基本模板:

<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>
Run Code Online (Sandbox Code Playgroud)

可能是什么导致了这个?难道我做错了什么?

Ale*_*lli 5

您通过指定服务的URL - url: /scripts将是类似的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你要求的任何页面.