0

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 
Carlos Martinez
  • 4,350
  • 5
  • 32
  • 62
  • Where is `favicon.ico` located? Remove the backslash from `upload: favicon\.ico`, to make it `upload: favicon.ico`. (Assuming it is at the root) – GAEfan Jun 06 '14 at 22:00
  • the favicon file is ok, the problem is on the css files, the browser can't find them on localhost and I don't understand why – Carlos Martinez Jun 06 '14 at 22:06
  • Your first call to the static directory is giving you a 500, not a 404. So, there is a coding error before it gets there. I don't believe `upload: favicon\.ico` is valid as a filename. – GAEfan Jun 06 '14 at 22:25
  • I just tested with a basic html, just linking to an external css file and It can't find it either, definitely It is not a problem with the app – Carlos Martinez Jun 06 '14 at 22:45
  • @GAEfan the `upload: favicon\.ico` is totally valid as you can write regexp rules there and it's actually how Goolge App Engine launcher is creating the new application. – Lipis Jun 06 '14 at 23:19
  • as GAEfan mentioned the first error is 500.. can you also give us the output of that error from the logs (in your console or from the launcher) – Lipis Jun 06 '14 at 23:21
  • 1
    Weird. What happens if you try in Chrome, instead of IE? And, in your test, is the css directory, and the html file at the root level (C:)? – GAEfan Jun 06 '14 at 23:22
  • I tried with IE, Chrome and Firefox, any of them can find the css files. And yes, the links are valid (they ones on the webapp2 app work when I deploy it). This is weird, I can't find anything similar on Internet... – Carlos Martinez Jun 06 '14 at 23:45
  • As everyone has pointed out here, you are getting an Error 500, this should not happen, and needs to be investigated. Hava look at the console log. – Tim Hoffman Jun 07 '14 at 00:59
  • What can I do to investigate it? there's no error message besides '500 internal server error' or '404 not found' – Carlos Martinez Jun 07 '14 at 01:34
  • Are you logged in as Administrator? Check your security settings (varies by Windows version) such as: http://www.activehelper.com/Common-Errors/cannot-create-file-c-program-display-txt-access-is-denied.html – GAEfan Jun 07 '14 at 01:35
  • Check the local logs. It should tell you the line of code triggering the error. I don't mean the browser's console; I mean the App Engine log. – GAEfan Jun 07 '14 at 01:36
  • Oh my god, It was a newbie mistake; The code was working fine on localhost using a Linux system so I thought it was just ok, the files weren't at root on C:/ and I was using an absolute path. I'm really sorry. Somehow, the 500 internal server error is persisting yet – Carlos Martinez Jun 07 '14 at 01:51
  • WARNING 2014-06-06 18:51:57,619 api_server.py:378] Could not initialize images API; you are likely missing the Python "PIL" module. got this warning on the logs, what does it means? – Carlos Martinez Jun 07 '14 at 01:56

1 Answers1

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

GAEfan
  • 11,244
  • 2
  • 17
  • 33
  • mime_type = "text/css" worked! now it renders the css files; however, i'm still getting the warning even though i added PIL to the libraries section. The problem is solved, thank you very much! – Carlos Martinez Jun 09 '14 at 00:13