Forbid caching when debugging

This commit is contained in:
TheAMM 2017-05-27 21:33:20 +03:00
parent d65602ee9f
commit 260dc2cdc8
1 changed files with 9 additions and 0 deletions

View File

@ -22,6 +22,15 @@ if app.config['DEBUG']:
app.config['DEBUG_TB_INTERCEPT_REDIRECTS'] = False
toolbar = DebugToolbarExtension(app)
app.logger.setLevel(logging.DEBUG)
# Forbid caching
@app.after_request
def forbid_cache(request):
request.headers['Cache-Control'] = 'no-cache, no-store, must-revalidate, max-age=0'
request.headers['Pragma'] = 'no-cache'
request.headers['Expires'] = '0'
return request
else:
app.logger.setLevel(logging.WARNING)