Hi, Static files are being served by default with a 12-hour cache timeout header. This makes perfect sense in production, but during development, it means pages have to be hard-refreshed. Sometimes that's a problem; for example, in my case, there's a full-page OpenLayers map, and hard-refreshing means the map takes quite a few seconds to load from scratch (on normal page reloads, the map loads instantly). Looking through the code, the caching behaviour seems not to be configurable. Would a configuration option be welcome in Flask? For example, STATIC_FILES_CACHE_TIMEOUT, which I could then set to zero? I can write a patch. Cheers, -- Alex
Speaking form my own experience, I would suggest that this is a very common need. In fact, I would not surprised to find patched implementations in the wild. I am curious how you would approach this. Adding STATIC_FILES_CACHE_TIMEOUT is a very expedient solution that works (where would that configuration go by the way - I'm not that familiar with the config options?). One interesting problem with this kind of thing that I have seen time and time again is completely unrelated to Flask or Python, and that is the issue of per developer configuration *settings* (i.e. the actual values) polluting the SCM. A symptom of this can be seen as constant commits of that configuration file. Do you Alex, or others on the list, have any thoughts or best practices around addressing that issue? On specific projects, I have put such config in the datastore to minimize 'config pollution', but that is not a generic solution. On Fri, Jul 8, 2011 at 1:48 PM, Alex Morega <alex@grep.ro> wrote: > Hi, > > Static files are being served by default with a 12-hour cache timeout > header. This makes perfect sense in production, but during development, it > means pages have to be hard-refreshed. > > Sometimes that's a problem; for example, in my case, there's a full-page > OpenLayers map, and hard-refreshing means the map takes quite a few seconds > to load from scratch (on normal page reloads, the map loads instantly). > > Looking through the code, the caching behaviour seems not to be > configurable. Would a configuration option be welcome in Flask? For example, > STATIC_FILES_CACHE_TIMEOUT, which I could then set to zero? I can write a > patch. > > Cheers, > -- Alex > >
The Flask docs have some useful tips on managing your config settings: http://flask.pocoo.org/docs/config/#development-production Jesse On Sat, Jul 9, 2011 at 5:58 AM, Jay Baker <jbaker.work@gmail.com> wrote: > Speaking form my own experience, I would suggest that this is a very common > need. In fact, I would not surprised to find patched implementations in the > wild. I am curious how you would approach this. Adding > STATIC_FILES_CACHE_TIMEOUT is a very expedient solution that works (where > would that configuration go by the way - I'm not that familiar with the > config options?). One interesting problem with this kind of thing that I > have seen time and time again is completely unrelated to Flask or Python, > and that is the issue of per developer configuration *settings* (i.e. the > actual values) polluting the SCM. A symptom of this can be seen as constant > commits of that configuration file. Do you Alex, or others on the list, have > any thoughts or best practices around addressing that issue? On specific > projects, I have put such config in the datastore to minimize 'config > pollution', but that is not a generic solution. > > On Fri, Jul 8, 2011 at 1:48 PM, Alex Morega <alex@grep.ro> wrote: >> >> Hi, >> >> Static files are being served by default with a 12-hour cache timeout >> header. This makes perfect sense in production, but during development, it >> means pages have to be hard-refreshed. >> >> Sometimes that's a problem; for example, in my case, there's a full-page >> OpenLayers map, and hard-refreshing means the map takes quite a few seconds >> to load from scratch (on normal page reloads, the map loads instantly). >> >> Looking through the code, the caching behaviour seems not to be >> configurable. Would a configuration option be welcome in Flask? For example, >> STATIC_FILES_CACHE_TIMEOUT, which I could then set to zero? I can write a >> patch. >> >> Cheers, >> -- Alex >> > >