-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
34 lines (25 loc) · 765 Bytes
/
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
from flask import Flask,jsonify, render_template, request
import json
app = Flask(__name__)
jData = json.loads(open('./nolan.json').read())
data=jData["NolanMovies"]
@app.route('/')
def movie_main():
return render_template("index.html")
@app.route('/getmovies/')
def movie_all():
myList=[]
for element in data:
myList.append(element)
result = jsonify(myList)
return render_template("index.html",items=myList)
@app.route('/getmovies/<string:Year>/')
def nolan(Year=''):
myList=[]
for element in data:
if element["Year"] == Year:
myList.append(element)
result = jsonify(myList)
return render_template("index.html",items=myList)
if __name__ == '__main__':
app.run(debug=True,host='0.0.0.0')