4
votes

My old version files are still appearing in Google App Engine (URL) even when:

  1. I tested new version after uploading ( 2.appid.appspot.com)
  2. Made new version as default version from dashboard.
  3. deleted old version.
  4. Cleared memcache

All new directories and files are created, but old files are not overwritten.

Okay let me put it in detail, initially i created version 1 using app.yaml:

application: app-id

version: 1

runtime: python27

api_version: 1

threadsafe: yes

default_expiration: "7d"

handlers: - url: /static/(..html) static_files: static/\1 upload: static/(..html)

url: /static/(..(css)) static_files: static/\1 upload: static/(..(css))

url: /static/(..(bmp|gif|ico|jpeg|jpg|png))$ static_files: static/\1 upload: static/(..(bmp|gif|ico|jpeg|jpg|png))

url: /static/(..(bmp|gif|ico|jpeg|jpg|png))$ static_files: static/\1 upload: static/(..(bmp|gif|ico|jpeg|jpg|png))

url: /static/(..mp4) static_files: static/\1 mime_type: static/mp4 upload: static/(..mp4)

url: .* script: main.app

libraries: - name: webapp2 version: "2.5.2"

then I created version 2 by using same app.yaml:

application: app-id

version: 2

runtime: python27

api_version: 1

threadsafe: yes

default_expiration: "7d"

handlers: - url: /static/(..html) static_files: static/\1 upload: static/(..html)

url: /static/(..(css)) static_files: static/\1 upload: static/(..(css))

url: /static/(..(bmp|gif|ico|jpeg|jpg|png))$ static_files: static/\1 upload: static/(..(bmp|gif|ico|jpeg|jpg|png))

url: /static/(..(bmp|gif|ico|jpeg|jpg|png))$ static_files: static/\1 upload: static/(..(bmp|gif|ico|jpeg|jpg|png))

url: /static/(..mp4) static_files: static/\1 mime_type: static/mp4 upload: static/(..mp4)

url: .* script: main.app

libraries: - name: webapp2 version: "2.5.2"

tested version 2 i.e. 2.app-id.appspot.com was working

went to dashboard made version 2 as default and then i deleted version 1 , but now:

1) static folder had 1 file named side.css (in version 1) and modified side.css (in version 2 ) and both are available via app-id.appspot.com/static/side.css and 2.app-id.appspot.com/static/side.css (modified)??

How can I remove old side.css available at app-id.appspot.com/static/side.css ???

1
how do you know old files are not overwritten? If the files are still available then you've re-loaded them or they are in the DB or the bucket.Paul Collingwood
May I know what kind of files u r referring to? And how you are saying old files exists , I meant where or how you seen it ?Ramesh Lingappa
I have added detailsls_milkyway
did you ever solve this? I have a similar problem but I think it is to do with caching in the browser stackoverflow.com/questions/46850418/…Yvonne Aburrow

1 Answers

2
votes

Head to your Google Cloud Console and open your project. Under the left hamburger menu, head to Storage -> Browser. There you should find at least one Bucket: your-project-name.appspot.com. Under the Lifecycle column, click on the link with respect to your-project-name.appspot.com. Delete any existing rules, since they may conflict with the one you will create now.

Create a new rule by clicking on the 'Add rule' button. For the object conditions, choose only the 'Newer version' option and set it to 1. Don't forget to click on the 'Continue' button. For the action, select 'Delete' and click on the 'Continue' button. Save your new rule.

This new rule will take up to 24 hours to take effect, but at least for my project it took only a few minutes. Once it is up and running, the version of the files being served by your app under your-project-name.appspot.com will always be the latest deployed, solving the problem. Also, if you are routinely editing your static files, you should remove any expiration element from handlers related to those static files and the default_expiration element from the app.yaml file, which will help avoid unintended caching by other servers.