Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

browser caching static files in flask?

Have been reading flask docs in python and building a local website.

Just performed a speed test on my website deployed on openshift with this tool here:-

The analysis report says that my site is not caching static resources. After googling this for all my worth I gather that:-

  • It has something to do with headers.
  • Cache copies are kept in the client machine and also servers between the client and website.

My Question

  • Am I to include expire and tags in the html section? Or in the HTTP header section?

  • If in the HTTP header section how do I do this?

If I have missed something in the docs please let me know.

like image 602
arjoonn Avatar asked Jul 10 '14 07:07

arjoonn


1 Answers

Either use 'SEND_FILE_MAX_AGE_DEFAULT' or look into webassests http://webassets.readthedocs.org/en/latest/

Similar question asked here. Flask static file Cache-Control

like image 108
PsyKzz Avatar answered Oct 13 '22 20:10

PsyKzz