-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
24 lines (21 loc) · 800 Bytes
/
app.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
import flask
from search import search
app = flask.Flask(__name__, template_folder='template')
@app.route('/', methods=['GET', 'POST'])
def main():
if flask.request.method == 'GET':
return(flask.render_template('search.html',
original_input='Search here',
result=None,
))
if flask.request.method == 'POST':
text = flask.request.form['name']
print(text)
result = search(text)
return (flask.render_template('search.html',
original_input=text,
result=result,
items = len(result)
))
if __name__ == '__main__':
app.run()