【问题标题】:Could not show images in Google App Engine无法在 Google App Engine 中显示图片
【发布时间】:2015-05-15 20:39:45
【问题描述】:

无法在 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))

【问题讨论】:

    标签: php google-app-engine app.yaml


    【解决方案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)$
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-09-23
      • 2013-12-25
      • 2013-04-07
      • 2012-09-05
      • 1970-01-01
      • 2011-08-07
      • 2013-07-30
      • 2015-08-12
      相关资源
      最近更新 更多