[英]CSS Files not working on localhost
The problem is just happening on localhost, when I upload the application to AppEngine, It succesfully finds the css files. 问题仅在本地主机上发生,当我将应用程序上传到AppEngine时,它成功找到了CSS文件。
I'm using python 2.7, the app is done on webapp2 and I'm using a local copy of bootstrap. 我正在使用python 2.7,该应用程序已在webapp2上完成,并且正在使用bootstrap的本地副本。
<link href="/static/bootstrap/css/bootstrap.css" rel="stylesheet" media="screen">
<link href="/static/bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
Those are my links to the css files, they work when I deploy the app http://main-cocoa-597.appspot.com/cenira , but they don't on localhost. 这些是我指向css文件的链接,当我部署应用程序http://main-cocoa-597.appspot.com/cenira时,它们可以工作,但不在本地主机上。
app.yaml 的app.yaml
application: main-cocoa-597
version: 1
runtime: python27
api_version: 1
threadsafe: yes
handlers:
- url: /favicon\.ico
static_files: favicon.ico
upload: favicon\.ico
- url: /static
static_dir: static
- url: /cenira.*
script: cenira.app
- url: .*
script: main.app
libraries:
- name: webapp2
version: "2.5.2"
- name: jinja2
version: latest
I think the problem has nothing to do with the app, since even the launcher's SDK Console is not loading It's css files either. 我认为问题与应用程序无关,因为即使启动器的SDK控制台也无法加载它的css文件。
I just installed Windows, maybe there's something missing? 我刚安装Windows,也许缺少一些东西? How can I solve this?
我该如何解决?
EDIT: 编辑:
just with a basic html (a div with a class), and linking to an external css file: 只需使用基本的html(带有类的div),然后链接到外部CSS文件即可:
<link href="/css/asd.css" rel="stylesheet">
getting this: 得到这个:
GET file:///C:/css/asd.css net::ERR_FILE_NOT_FOUND
For PIL, add this to the libraries
section of app.yaml: 对于PIL,请将其添加到app.yaml的
libraries
部分:
- name: PIL
version: latest
To diagnose the 500 error in your css request, try adding this: 要诊断CSS请求中的500错误,请尝试添加以下内容:
- url: /static/css
static_dir: static/css
mime_type = "text/css"
(This needs to be ABOVE your - url /static
call, so it runs first (这需要在您的
- url /static
调用之上,因此它首先运行
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.