-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
48 lines (37 loc) · 1.37 KB
/
Copy pathmain.py
File metadata and controls
48 lines (37 loc) · 1.37 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
41
42
43
44
45
46
47
48
from concurrent.futures import ThreadPoolExecutor
from flask import Flask, render_template, request
from functions import *
app = Flask('Crypto Converter',
static_folder='static',
template_folder="templates")
@app.route('/', methods=["GET", "POST"])
def home():
homedata = {'supportedcoins': getSupportedCoins()}
return render_template('index.html', data=homedata)
@app.route('/results', methods=["GET", "POST"])
def GraphGenerator():
coin1 = str(request.form.get('first'))
coin2 = str(request.form.get('second'))
years = request.form.get('third')
dates = []
firstmoney = []
secondmoney = []
for keys, values in getCoinData(convertCoin(coin1), years).items():
dates.append(keys)
firstmoney.append(values)
for keys, values in getCoinData(convertCoin(coin2), years).items():
secondmoney.append(values)
graphdata = {
'firstmoney': firstmoney,
'dates': dates,
'secondmoney': secondmoney,
'coin1': coin1,
'coin2': coin2,
'combined': combine(convertCoin(coin1), convertCoin(coin2), years)
}
return render_template('results.html', data=graphdata)
@app.route('/about', methods=['GET', 'POST'])
def about():
return render_template("about.html")
app.run(host='0.0.0.0', port=6969, threaded=True)
# I saw an article about how apparently this speeds up the load speed by a lot, wanna try it