Search code examples
pythongoogle-app-enginecloudyamlstatic-files

App Engine Static Files Path


I have a strange problem with App Engine in Python. My css files aren't found (404 error), because under some URLs the path to static files is not found. My app.yaml file looks like this:

application: my-app
version: 1
runtime: python27
api_version: 1
threadsafe: yes

handlers:
- url: .*/static
  static_dir: static

- url: /admin
  script: main.app
  login: admin

- url: /.*
  script: main.app

libraries:
- name: webapp2
  version: "2.5.2"

- name: jinja2
  version: latest

builtins:
- appstats: on

Everything works fine, but when I try to upload a blob, it redirects me on /_ah/upload/3453409fd2... but there is no css style to be found or at least not in production. In development/locahost it returns /_ah/static/css/style.css HTTP/1.1" 200, therefore the file was found, but on the server the files aren't probably found, because the page doesn't render properly (without css).

Do you guys have any idea how can this be solved, because it has been bugging me some time now.


Solution

  • Remove the .* from the static handler and it should fix your static files.

    - url: /static
      static_dir: static
    

    and you should have your static directory in the same level with your app.yaml file.