Search code examples
imagegoogle-app-enginestatic-linking

Why my static imagea are not displayed?


I'm running a Google App locally.

I have a folder with static images I want to pull. Folder is called "images" (it's in the root)

In my app.yaml I have this code:

- url: /images
  static_files: images
  upload: images

But when the app is running and trying to grab an image I get 404:

localhost:8080/images/truck.png

What am I doing wrong? Thank you.


Solution

  • Try Using this:

    application: test
    version: 1
    runtime: python27
    api_version: 1
    threadsafe: false
    
    handlers:
    - url: /resources
      static_dir: resources
    
    - url: /.*
      script: main.app
    
    libraries:
    - name: jinja2
      version: latest
    

    Ensure that the resources url is before the /.* url.

    I have my project set up as follows

    /test
    /test/resources
    /test/resources/images
    /test/resources/images/myimage.png
    app.yaml
    main.py