Google app engine Google应用程序引擎在部署时丢失CSS
当我将我的应用程序部署到Google应用程序引擎时,CSS不再被找到。该应用程序在本地主机中运行良好。我不知道这到底是为什么。应用程序引擎是否更改了文件结构?我在日志中发现以下错误:Google app engine Google应用程序引擎在部署时丢失CSS,google-app-engine,python-2.7,Google App Engine,Python 2.7,当我将我的应用程序部署到Google应用程序引擎时,CSS不再被找到。该应用程序在本地主机中运行良好。我不知道这到底是为什么。应用程序引擎是否更改了文件结构?我在日志中发现以下错误: 2012-10-26 14:04:37.727 Static file referenced by handler not found: stylesheets/main.css 这是我的应用程序 application: vipermonkeyswhofly version: 1 runtime: python
2012-10-26 14:04:37.727 Static file referenced by handler not found:
stylesheets/main.css
这是我的应用程序
application: vipermonkeyswhofly
version: 1
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /stylesheets
static_dir: stylesheets
- url: /.*
script: vipermonkeyswhofly.app
libraries:
- name: jinja2
version: 2.6
My index.html具有以下url:
检查文件夹和文件在文件系统中是否也是小写的。(/stylesheets/main.css)
如果您使用的是Windows,那么它似乎不区分大小写,但生产环境是如此。另一个值得注意的是,main.css仅在“使用JSP”之后的“使用静态文件”部分中创建。因此,如果您喜欢我并在每个部分之后部署,您将看到此错误,直到您创建main.css文件。同样值得注意的是,在您的app.yaml
文件中,如果您有以下映射:
# static directories #
- url: /css
static_dir: css
- url: /img
static_dir: img
- url: /js
static_dir: js
您的HTML文件需要像这样引用它们(注意文件路径中的前导/行):
就是这样。非常感谢你的帮助!
# static directories #
- url: /css
static_dir: css
- url: /img
static_dir: img
- url: /js
static_dir: js
<link href="/css/style.css" rel="stylesheet"/>