D
D
difficultnicknameforcommu2017-07-06 15:01:42
Flask
difficultnicknameforcommu, 2017-07-06 15:01:42

How to disable query caching?

I'm making a Flask project using sqlalchemy + postgresql. It has a listing of products for each category. The problem is that when entering a category, products appear not from the current category, but from the previous one. But when you change the code and restart, everything works fine (until you start going through the categories).

I launch through app.run(debug=False).

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
pcdesign, 2017-07-06
@pcdesign

Disable template caching: Disable content caching:

@app.after_request
def add_header(response):
    response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'
    response.headers['Cache-Control'] = 'public, max-age=0'
    return response

And here it should be
debug=True

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question