Static_files vs Static_dir Cache Expiration Header in Python App Engine

I am using Google App Engine 1.7.2 / Python 2.7 and trying to add client-side caching of static files.

When I specify static_dir in my app.yaml application, cache control headers will not be set.

- url: /static/images static_dir: static/images expiration: "7d 0h" 

However, when I switch the specification to static_files, like the following, it becomes set.

 - url: /static/images(.*) static_files: static/images/\1 upload: static/(.*) expiration: "7d 0h" 

Does anyone else see this? Am I missing something? I got the impression that static_dir and static_files are equivalent if they are written as above.

Thanks!

+4
source share
1 answer

I understand that your question was asked some time ago, but I ran into it while searching for a similar problem and thought that I would answer it for the sake of others.

You correctly specified static file handlers. The problem with caching is probably due to the fact that you are logged in as an administrator in a browser (registered at appengine.google.com). Running an application that is not logged in as an administrator should show how caching works. Here is a link to the 'issue' .

+3
source

Source: https://habr.com/ru/post/1441449/


All Articles