Hi all,
GAE changed something recently such that when i update my application
version it still serves *old* copies of my static files. Bad Google! With
the help of some friends here:
https://groups.google.com/forum/#!topic/google-appengine/izSeUolA1ho I came
up with this for use in web2py:
in your app.yaml, change the block for static files to:
- url: /(?P<a>.+?)/static/.*?/(?P<b>.+)
static_files: applications/\1/static/\2
upload: applications/(.+?)/static/(.+)
secure: optional
expiration: "90d"
note the ".*?" which will match any string. we are then going to use
routes.py to insert a version number in the string
in routes.py:
import os
version_id = os.environ.get('CURRENT_VERSION_ID', '0')
...
routes_out = (...
('/$a/static/(?P<f>.*)', '/$a/static/%s/$f'%version_id), #add
a version id to static links to break the google cache on version changes
...)
Note that this does not work if you are serving files that are referenced
outside of web2py, or if the url is built without URL(). but for your css
and images used internally only it seems to work well.
Christian