-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathapp.py
More file actions
69 lines (56 loc) · 1.64 KB
/
app.py
File metadata and controls
69 lines (56 loc) · 1.64 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
from flask import Flask, render_template, request
import sys
sys.path.append("../")
class CustomFlask(Flask):
jinja_options = Flask.jinja_options.copy()
jinja_options.update(
dict(
block_start_string="<%",
block_end_string="%>",
variable_start_string="%%",
variable_end_string="%%",
comment_start_string="<#",
comment_end_string="#>",
)
)
app = CustomFlask(__name__)
@app.route("/")
def hello_world():
context = {"name": "Ram"}
return render_template("index.html", **context)
@app.route("/test", methods=["GET", "POST"])
def test():
# Test function
if request.method == "POST":
return str(request.form)
@app.route("/ds", methods=["GET", "POST"])
def ds():
controls = [
{
"input": True,
"type": "file",
"name": "directory",
"placeholder": "Select a directory with a file",
},
{
"input": True,
"type": "text",
"name": "engine",
"placeholder": "sqlalchemy connection string or HDF5 filename",
},
{
"input": True,
"type": "text",
"name": "tablename",
"placeholder": "tablename in SQL or HDF",
},
{"select": True, "name": "mode", "choices": ["SQL", "HDF"]},
]
context = {"controls": controls}
if request.method == "GET":
return render_template("datastore.html", **context)
elif request.method == "POST":
print(request.form)
return str(request.form)
if __name__ == "__main__":
app.run(debug=True)