MarioWeb/main.py

35 lines
663 B
Python
Raw Normal View History

2022-10-20 14:48:14 +00:00
from flask import Flask, render_template, request, redirect, url_for
2022-10-21 09:46:57 +00:00
app = Flask(__name__, static_folder='')
bufferJson = ['']
2022-10-20 14:48:14 +00:00
@app.route('/')
def index():
py2htmlstr = 'py2html test str'
2022-10-21 09:46:57 +00:00
return render_template('play.html', py2htmlstr=py2htmlstr)
2022-10-20 14:48:14 +00:00
2022-10-21 09:46:57 +00:00
@app.route('/datapage')
def datapage():
return bufferJson
2022-10-20 14:48:14 +00:00
2022-10-21 09:46:57 +00:00
2022-10-24 11:48:43 +00:00
@app.route('/eval')
def eval():
return render_template('eval.html')
2022-10-21 09:46:57 +00:00
@app.route('/', methods=['POST'])
2022-10-20 14:48:14 +00:00
def getData():
2022-10-21 09:46:57 +00:00
if request.method == 'POST':
print("POST")
print(request.json)
return redirect(url_for('datapage'))
2022-10-20 14:48:14 +00:00
if __name__ == '__main__':
2022-10-21 09:46:57 +00:00
app.debug = True
app.run()
app.run(debug=True)