Search code examples
htmlcssgoogle-app-enginetwitter-bootstrapwebapp2

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.

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.

problem

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 

Solution

  • 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