29 lines
649 B
Python
29 lines
649 B
Python
|
from flask import request
|
||
|
import settings
|
||
|
from funding.factory import app, db
|
||
|
|
||
|
|
||
|
@app.before_request
|
||
|
def before_request():
|
||
|
pass
|
||
|
|
||
|
|
||
|
@app.after_request
|
||
|
def after_request(res):
|
||
|
res.headers.add('Accept-Ranges', 'bytes')
|
||
|
|
||
|
if request.full_path.startswith('/api/'):
|
||
|
res.headers.add('Access-Control-Allow-Origin', '*')
|
||
|
|
||
|
if settings.DEBUG:
|
||
|
res.headers['Cache-Control'] = 'no-cache, no-store, must-revalidate'
|
||
|
res.headers['Pragma'] = 'no-cache'
|
||
|
res.headers['Expires'] = '0'
|
||
|
res.headers['Cache-Control'] = 'public, max-age=0'
|
||
|
return res
|
||
|
|
||
|
|
||
|
@app.errorhandler(404)
|
||
|
def error(err):
|
||
|
return 'Error', 404
|