-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.py
More file actions
40 lines (35 loc) · 1.23 KB
/
app.py
File metadata and controls
40 lines (35 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from xml.dom.pulldom import parseString
from flask import Flask, render_template, url_for, request, redirect
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
res = 0
pro = 0
@app.route('/')
def index2():
return render_template('index.html')
@app.route('/enter-values', methods = ['POST', 'GET'])
def index1():
global res,pro
if request.method == 'POST':
res_content = request.form['res']
pro_content = request.form['pro']
res = int(res_content)
pro = int(pro_content)
data = str(res_content) + " " + str(pro_content)
return render_template('values.html',data = data)
else:
return render_template('index.html')
@app.route('/play', methods = ['POST', 'GET'])
def index():
if request.method == 'POST':
data = str(res) + " " + str(pro) + " "
for i in range(res + 2*pro*res):
if(i < res + 2*pro*res - 1):
data = data + request.form[str(i)] + " "
else:
data = data + request.form[str(i)]
return render_template('play.html',data = data)
else:
return render_template('values.html')
if __name__ == '__main__':
app.run(debug = True)