config.py 415 B

123456789101112131415161718
  1. from flask import request, session
  2. DNT_TRACK = True #False
  3. IGNORE_IPS = set(['127.0.0.1'])
  4. def is_tracking_allowed():
  5. #print(request.headers)
  6. if 'DNT' in request.headers and request.headers['DNT'] == 1:
  7. return False
  8. if request.remote_addr in IGNORE_IPS:
  9. return False
  10. return True
  11. def track_session():
  12. if 'track_session' in session and session['track_session'] == True:
  13. return True
  14. else:
  15. return False