-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
50 lines (46 loc) · 1.15 KB
/
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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
from flask import Flask, render_template
# give flask app a name
app = Flask(__name__)
JOBS=[
{
'id':1,
'title':'Data Analyst',
'location':'Bengaluru, India',
'salary':'Rs. 10,00,000'
},
{
'id':2,
'title':'Data Scientist',
'location':'Delhi, India',
# 'salary':'Rs. 15,00,000'
},
{
'id':3,
'title':'Frontend Engineer',
'location':'Remote',
'salary':'Rs. 20,00,000'
},
{
'id':4,
'title':'Backend Engineer',
'location':'San Francisco, USA',
'salary':'$120,000'
}
]
# name application
# creating a route
@app.route(
"/"
) # telling the flask that when a particular url is selected what should be returned
# route is a part of url after the domain name and everything after that is a path or a route
# @ -> decorator in python
# route is a function
# / is an empty route
# what should be returned when the route is selected
# when url / is accessed then show hello world
# DEFINING A FUNCTION
def hello_world():
return render_template("home.html", jobs=JOBS)
# templates are used to decide what is displayed on webpage
if (__name__) == "__main__":
app.run(host='0.0.0.0', debug=True)