main.py 261 B

123456789101112131415
  1. import visitor
  2. from app import app
  3. from flask import jsonify
  4. @app.before_request
  5. def do_something_when_a_request_comes_in():
  6. visitor.track_visitor()
  7. @app.route('/')
  8. def home():
  9. return jsonify({'msg' : 'hello'})
  10. if __name__ == "__main__":
  11. app.run()