App Engine:静态文件不在部署中更新 [英] App Engine: Static Files Not Updating on Deploy

查看:74
本文介绍了App Engine:静态文件不在部署中更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我推送了一个包含Angular SPA的HTML静态文件作为我的自定义域的全部捕获处理程序,并使用以下设置:

  -  url:/(api|activate|associate|c|close_fb|combine|import|password|sitemap)($|/.*)
script:gae.php

- url: /.*
static_files:public / static / app / v248 / es / app.html
上传:public / static / app / v248 / es / app.html
过期:1h

工作正常,但如果我推送新的app.html,它不会更新。我试图改变本地路径,部署一个新的应用程序版本,甚至用自定义的php端点来替换全部处理程序,但它不起作用,响应仍然是我上传的app.html的第一个版本。

其他人也有同样的问题( CSS文件不能更新部署(Google AppEngine)),它看起来像Google CDN缓存,但据我所知,没有任何方法可以刷新它。

解决方案

在App Engine应用程序中执行静态文件更改时,由于缓存,正如您已经想象的那样。 Google Cloud中的缓存无法手动刷新,因此,如果您想测试其工作方式并稍后根据需要设置适当的到期时间,我建议您将到期时间更改为较短的时间段(默认为10分钟)请注意您可以更改静态缓存过期时间 / standard / python / config / appref#default_expirationrel =nofollow noreferrer>用于所有静态文件或仅用于您选择的,只需在 app.yaml 文件中设置适当的元素即可。


I pushed an HTML static file containing an Angular SPA as catch-all handler for my custom domain with this settings:

- url: /(api|activate|associate|c|close_fb|combine|import|password|sitemap)($|/.*)
  script: gae.php

- url: /.*
  static_files: public/static/app/v248/es/app.html
  upload: public/static/app/v248/es/app.html
  expiration: "1h"

That worked fine, but if I push a new app.html it doesn't update. I've tried to change the local path, deploy a new app version, even replacing the catch-all handler with a custom php endpoint, but it doesn't work, the response still is the first version of app.html I uploaded.

Other people has had the same problem (CSS File Not Updating on Deploy (Google AppEngine)), and it looks like is related to Google CDN cache but, as far as I know, there isn't any way to flush it.

解决方案

When performing changes in static files in an App Engine application, changes will not be available immediately, due to cache, as you already imagined. The cache in Google Cloud cannot be manually flushed, so instead I would recommend you to change the expiration time to a shorter period (by default it is 10 minutes) if you want to test how it works, and later setting an appropriate expiration time according to your requirements.

Bear in mind that you can change the static cache expiration time both for all static files or for just the ones you choose, just by setting the proper element in the app.yaml file.

这篇关于App Engine:静态文件不在部署中更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆