본문 바로가기
PRACTICE/Basic

[Flask] input값에 따라 Pass, Fail 문자 출력하기

by 1005 2020. 11. 24.

< 폴더경로 >

 

 

< result.html >

 

1
2
3
4
5
6
7
8
9
10
<!doctype html>
<html>
   <body>
      {% if marks>50 %}
         <h1> Your result is pass!</h1>
      {% else %}
         <h1>Your result is fail</h1>
      {% endif %}
   </body>
</html>
 

 

< template_test.py >

 

1
2
3
4
5
6
7
8
9
from flask import Flask, render_template
app = Flask(__name__)
 
@app.route('/input/<int:score>')
def input_name(score):
   return render_template('result.html', marks = score)
 
if __name__ == '__main__':
   app.run(host='0.0.0.0', port='80', debug = True)

 

 

 

 

 

댓글