CSS Files not working on localhost

做~自己de王妃 提交于 2019-12-25 03:56:06

问题


The problem is just happening on localhost, when I upload the application to AppEngine, It succesfully finds the css files.

I'm using python 2.7, the app is done on webapp2 and I'm using a local copy of 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.

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.

I just installed Windows, maybe there's something missing? How can I solve this?

EDIT:

just with a basic html (a div with a class), and linking to an external css file:

<link href="/css/asd.css" rel="stylesheet">

getting this:

GET file:///C:/css/asd.css net::ERR_FILE_NOT_FOUND 

回答1:


For PIL, add this to the libraries section of app.yaml:

- name: PIL
  version: latest

To diagnose the 500 error in your css request, try adding this:

- url: /static/css
  static_dir: static/css
  mime_type = "text/css"

(This needs to be ABOVE your - url /static call, so it runs first



来源:https://stackoverflow.com/questions/24091187/css-files-not-working-on-localhost

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!