0
votes

Could not show images in Google App Engine

My need is deploy some png images to GAE. i have tried with these two codes in app.yaml. But the webpage does not show the png images

- url: /(.*\.(gif|png|jpg|ico|jpeg))
  static_files: \1
  upload: (.*\.(gif|png|jpg|ico|js|css|jpeg))


- url: /(.*\.(gif|png|jpg|ico|jpeg))
  static_files: /\1
  upload: /(.*\.(gif|png|jpg|ico|js|css|jpeg))

my current app.yaml file content

api_version: 1
threadsafe: yes

runtime: php
application: samplesite
version: 1

handlers:

- url: /
  script: index.php

- url: /(.+\.php)$
  script: \1

- url: /(.*\.(gif|png|jpg|ico|jpeg))
  static_files: \1
  upload: (.*\.(gif|png|jpg|ico|js|css|jpeg))
1

1 Answers

1
votes

Move your root handler to the bottom. It is overriding all the other entries below it.

Many also place static files under a particular directory in their source so they are easily managed.

# All URLs ending in .gif .png or .jpg are treated as paths to static files in
# the static/ directory. The URL pattern is a regexp, with a grouping that is
# inserted into the path to the file.
- url: /(.*\.(gif|png|jpg))$
  static_files: static/\1
  upload: static/.*\.(gif|png|jpg)$