forked from opszero/template-aws-lambda-django
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
31 lines (23 loc) · 658 Bytes
/
Copy pathapp.py
File metadata and controls
31 lines (23 loc) · 658 Bytes
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
import os
from flask import Flask, render_template
from pynamodb.models import Model
from pynamodb.attributes import UnicodeAttribute
app = Flask(__name__)
class OneTable(Model):
'''
DynamoDB works best with a single table. This table. Use this table to model
other data requests.
'''
class Meta:
table_name = os.environ['DYNAMODB_TABLE_NAME']
pk = UnicodeAttribute(hash_key=True)
sk = UnicodeAttribute(range_key=True)
@app.route("/")
def cats():
return render_template('index.html')
@app.route("/dogs/<id>")
def dog(id):
return "Dog"
@app.route("/health")
def health():
return { "status": "Success" }