为什么 GAE 在部署时会跳过更改的文件?

Why does GAE skip changed files when deploying?

通常当我对 .js 或 .css 文件进行本地更改然后部署应用程序时,这些文件会被跳过。怎么回事?

例如,假设我编辑:

public_html/www/account/dashboard/dashboard.css

部署时,我在日志中看到:

`Skipping upload of [public_html/www/account/dashboard/dashboard.css]

这是我 app.yaml

中的 skip_files 规则
skip_files:
    - ^(.*/)?#.*#$
    - ^(.*/)?.*~$
    - ^(.*/)?.*\.py[co]$
    - ^(.*/)?.*/RCS/.*$
    - ^(.*/)?\..*$
    - ^.*node_modules(/.*)?
    - ^data/.*$
    - ^public_html/data/.*$

不确定这是否相关,但这里有一条 static_files 规则,用于使我的 css application_readable:

- url: /(.*\.(gif|png|jpg|jpeg|js|html|css|json|tpl))$
  static_files: public_html/www/
  upload: public_html/www/.*\.(gif|png|jpg|js|html|css|json|tpl)$
  application_readable: true

终于在文档中找到了答案。它与静态文件缓存过期有关。听起来没有办法立即清除静态文件缓存。最好的办法是将 default_expiration 设置为较短的时间段,我的设置为 7 天。

这是文档的 link:

https://cloud.google.com/appengine/docs/standard/python/config/appref#static_cache_expiration

这是来自文档的解释

The expiration time will be sent in the Cache-Control and Expires HTTP response headers, and therefore, the files are likely to be cached by the user's browser, as well as by intermediate caching proxy servers such as Internet Service Providers. After a file is transmitted with a given expiration time, there is generally no way to clear it out of intermediate caches, even if the user clears their own browser cache. Re-deploying a new version of the app will not reset any caches. Therefore, if you ever plan to modify a static file, it should have a short (less than one hour) expiration time. In most cases, the default 10-minute expiration time is appropriate.