-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.py
37 lines (28 loc) · 943 Bytes
/
index.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
from flask import Flask, render_template, request
import json
import boto3
app = Flask(__name__)
dynamodb = boto3.resource('dynamodb')
table = dynamodb.Table('news-site')
def get_outputs(page):
response = table.get_item(
Key={'page': page})
outputs = response['Item']['content']
return outputs
@app.route("/", methods=['GET'])
def news_create():
outputs = get_outputs('news')
return render_template('news.html', outputs=outputs)
@app.route("/supreme_court", methods=['GET'])
def sp_create():
outputs = get_outputs('supreme_court')
return render_template('supreme_court.html', outputs=outputs)
@app.route("/congress", methods=['GET'])
def congress_create():
outputs = get_outputs('congress')
return render_template('congress.html', outputs=outputs)
@app.route("/about", methods=['GET'])
def about_create():
return render_template('about.html')
if __name__ == "__main__":
app.run(debug=True, host='127.0.0.1')