Skip to content

Commit 6233f5b

Browse files
committed
complete Part 2
1 parent 38e2d87 commit 6233f5b

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

part2/reverse_flask_herd/project/reverse_flask.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
app = Flask(__name__)
55

6-
app.config['DEBUG'] = False
6+
app.config['DEBUG'] = True
77

88

99
@app.route('/')
@@ -13,8 +13,8 @@ def get_string():
1313

1414
@app.route('/reverse_string', methods=['POST'])
1515
def reverse_string():
16-
str_to_reverse = request.form['str_to_reverse']
1716
return render_template(
1817
'result.html',
19-
result=str_to_reverse[::-1]
18+
original_str = request.form['str_to_reverse'],
19+
result=request.form['str_to_reverse'][::-1]
2020
)

part2/reverse_flask_herd/project/templates/result.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@
55
<title></title>
66
</head>
77
<body>
8+
Original string: <strong>{{ original_str }}</strong>
9+
<br>
810
Reversed string: <strong>{{ result }}</strong>
11+
<br>
12+
<br>
13+
<a href="/">Try again</a>
914

1015
</body>
1116
</html>

0 commit comments

Comments
 (0)