mirror of
https://gitlab.com/SIGBUS/nyaa.git
synced 2024-12-22 20:19:59 +00:00
Forbid caching when debugging
This commit is contained in:
parent
d65602ee9f
commit
260dc2cdc8
|
@ -22,6 +22,15 @@ if app.config['DEBUG']:
|
||||||
app.config['DEBUG_TB_INTERCEPT_REDIRECTS'] = False
|
app.config['DEBUG_TB_INTERCEPT_REDIRECTS'] = False
|
||||||
toolbar = DebugToolbarExtension(app)
|
toolbar = DebugToolbarExtension(app)
|
||||||
app.logger.setLevel(logging.DEBUG)
|
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:
|
else:
|
||||||
app.logger.setLevel(logging.WARNING)
|
app.logger.setLevel(logging.WARNING)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue