-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflaskdeploy.py
62 lines (40 loc) · 1.48 KB
/
flaskdeploy.py
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
from flask import Flask
from flask import Flask, request, render_template
import Clustering
import QueryExecutor
app = Flask(__name__)
app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 0
app.config["CACHE_TYPE"] = "null"
@app.route('/')
def input_form():
return render_template('index.html')
@app.route('/', methods=['POST'])
def my_form_post():
clusters = request.form['clusters']
comments = request.form['comments']
topwords = request.form['topwords']
#print(type(clusters))
#print(clusters)
#print(comments)
#print(topwords)
clusterObj = Clustering.Clustering(int(clusters), int(comments), int(topwords))
clusterObj.main_func()
return render_template('output.html')
@app.route("/queryexec", methods=['GET', 'POST'])
def queryexec():
if request.method == 'POST':
query = request.form["username"]
obj = QueryExecutor.QueryExecutor(query)
obj.save_to_html()
return render_template('sqloutput.html')
return render_template('queryexec.html')
# No caching at all for API endpoints.
@app.after_request
def add_header(response):
# response.cache_control.no_store = True
response.headers['Cache-Control'] = 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0, max-age=0'
response.headers['Pragma'] = 'no-cache'
response.headers['Expires'] = '-1'
return response
if __name__ == '__main__':
app.run()