Developing with Flask and Mustache

I'm using Flask to make a web app and using mustache templates (alongwith sammy.js). I'm running the app with debug=True but whenever I make changes in the mustache template (or other static assets) I need to clear the browser cookies and cache to make sure that the changes are visible. Other times, I need to use Chrome in incognito mode to see the changes. How can I avoid this hassle? Is there a way to see the changes by just reloading the page.

Answers


The simplest way would be to deactivate the cache in your browser. In Chrome is there a great checkbox under the settings of the web inspector.

A other way should be to remove the cache http header keys. There is a flask settings key SEND_FILE_MAX_AGE_DEFAULT with that you should control the cache lifetime of static files.


You can manage your static assets using the Flask-Assets extension. The library the extension uses allows for cache busting.

You might also want to render your mustache templates into the template itself, rather than an external javascript file, when developing. The Flask-mustachejs flask extension enables this, and has documentation on loading the templates differently in development and production.


Need Your Help

IBM Bluemix : How to access the Dashboard view in the new console of IBM Bluemix

console ibm-cloud dashboard

I have been using the IBM Bluemix console, the new version lately. I am unable to find the Dashboard view as available in the classic version of IBM Bluemix console. Please help in identifying the

How to locate my Maven path in commandprompt?

java maven

I have Windows7 and I'm trying to install maven and test it.