-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathayush.py
38 lines (30 loc) · 900 Bytes
/
ayush.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
29
30
31
32
33
34
35
36
37
38
### Building Url Dynamically
####Variable Rules And URL Building
from flask import Flask,redirect,url_for,render_template
import os
app=Flask(__name__)
@app.route('/')
def welcome():
return render_template('index.html')
img=os.path.join('static','images')
@app.route('/')
def home():
file=os.path.join(img,'logoChatMuse-modified.png')
return render_template('index.html', image=file)
@app.route('/success/<int:score>')
def success(score):
return "<html><body><h1>The Reult is passed</h1></body></html>"
@app.route('/fail/<int:score>')
def fail(score):
return "The Person has failed and the marks is "+ str(score)
### Result checker
@app.route('/results/<int:marks>')
def results(marks):
result=""
if marks<50:
result='fail'
else:
result='success'
return redirect(url_for(result,score=marks))
if __name__=='__main__':
app.run(debug=True)