简体   繁体   English

CSS文件在localhost上不起作用

[英]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.

相关问题 css 动画在 localhost (xampp) 中不起作用 - css animation is not working in localhost (xampp) 为什么在本地使用xampp的CSS无法正常工作,但是在本地或从Netlify站点打开相同文件时CSS仍能正常工作? - Why is my CSS not working properly in localhost using xampp but working fine when same files are opened locally or from a Netlify site? CSS文件和图片不会显示在localhost上 - CSS files and pictures dosen't show on localhost 我的页面看不到localhost上的CSS文件 - My page doesnt see css files on localhost CSS3筛选器可在localhost上运行,但不能在远程主机上运行 - CSS3 filter working on localhost but not on remote host CSS在live heroku网站上不起作用,但在localhost上起作用 - CSS not working on live heroku website but works on localhost Bootstrap CSS在Github Pages上不起作用,但在localhost中起作用 - Bootstrap CSS not working on Github Pages, but works in localhost 本地 JQuery 和 JQuery 移动文件在本地主机上不起作用 - Local JQuery and JQuery mobile files not working on localhost 文件从本地主机移至serv时,登录表单无法正常工作 - Login form working not working when files move from localhost to serv WordPress的本地主机:链接参考CSS / JS文件的正确方法? - localhost for wordpress: correct way to link reference css/js files?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM