-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflask-try3.py
28 lines (23 loc) · 864 Bytes
/
flask-try3.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
from flask import Flask, render_template, request
from werkzeug.utils import redirect
from vsearch import search4letters
app = Flask(__name__)
@app.route('/search4', methods=['POST'])
def do_search() -> 'html':
phrase = request.form['phrase']
letters = request.form['letters']
title = 'Here are your results:'
results = str(search4letters(phrase, letters))
return render_template('results.html',
the_title=title,
the_phrase=phrase,
the_letters=letters,
the_results=results,)
@app.route('/')
def hello() -> '302':
return redirect('/entry')
@app.route('/entry')
def entry_page() -> 'html':
return render_template('entry.html',
the_title='Welcome to search4letters on the web!')
app.run(debug=True)