from flask import Flask, request, render_template, send_file


app = Flask(__name__)


@app.route('/')
def index():
    return render_template('index.html')
@app.route('/px2.js')
def js():
    return send_file('templates/px2.js', )
@app.route('/mouse.js')
def mouse():
    return send_file('templates/mouse.js', )
@app.route('/env/px/env', methods=["POST"])
def collect():
    print('env.',request.data.decode())
    return 'ok'

@app.route('/px/env/mouse', methods=["POST"])
def mouses():
    print('mouse.',request.data.decode())
    return 'ok'
@app.route('/collect/mouse', methods=["POST"])
def collectMouse():
    print(request.data.decode())
    return 'ok'
if __name__ == '__main__':
    app.run(host='0.0.0.0',debug=True, port=11233)