I really could not find any resource on this. So how can I seperate caching of views/functions than static files (i.e. .css,.js)? I want to cache my static objects for a week, on the other hand I need to cache functions/views for only a few minutes.
When I do following
from flask.ext.cache import Cache
cache = Cache(config={'CACHE_TYPE': 'simple'})
cache.init_app(app)
@cache.cached(timeout=500)
def index():
return render_template('index.html')
then all views, objects' cache time is set to the same value, 500. How to go about it?
I would not server the static files from my python application but try to delegate that to the web server (nginx, apache... ). Then you could set the time to expire through headers controlling how long should the browser cache them.