无法在Google App Engine中显示图片
我需要将一些png图像部署到GAE。我在app.yaml中试过这两个代码。但网页没有显示png图像
- 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))
我当前的app.yaml文件内容
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))
答案 0 :(得分:1)
将根处理程序移到底部。它覆盖了它下面的所有其他条目。
许多人还将静态文件放在其源中的特定目录下,以便轻松管理。
# 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)$