Question: I made a change on one of the `.js` files that I use and no matter what I do, flask insists on picking up, from memory cache, the last version of the file, without the change.

To clarify, I have the following structure. It all starts with `foo.html`

```
return render_template foo.html

```

`foo.html` has a form inside that calls flask with some data and then returns a second template `bar.html`:

```
return render_template bar.html

```

This second template calls some `.js` file, placed in the `static` folder, but it doesn't update when the code changes.

I mention the structure above because if the `.js` file was placed on `foo.html` instead of `bar.html` then Flask **would** pick up the new changes on the file. But in `bar.html` Flask completely ignores them.

What is happening? 

The only thing that worked was to click on "disable cache" on the browser and reload again.

Answer: 
If you are serving your static assets with Flask (this is typically the case in a development environment), then you might need to set the [`SEND_FILE_MAX_AGE_DEFAULT` configuration value](https://flask.palletsprojects.com/en/1.1.x/config/#SEND_FILE_MAX_AGE_DEFAULT):

> 
> Default cache control max age to use with `send_static_file()` (the default static file handler) and `send_file()`, as `datetime.timedelta` or as seconds. Override this value on a per-file basis using the `get_send_file_max_age()` hook on Flask or Blueprint, respectively. Defaults to 43200 (12 hours).
> 
> 
> 

Solving this can be as simple as updating the `app.config` dictionary, like so:

```
app = Flask(__name__)
...
app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 0

```

If you do that, your browser will not cache static assets that are served by Flask.
Use:

```
if __name__ == '__main__':
    app.config['TEMPLATES_AUTO_RELOAD'] = True
    app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 0
    app.run(debug=True)

```

You can update using `F5` or `CTRL + R`.