from datetime import datetime, date
import json

from flask import Flask, jsonify
from flask.json import JSONEncoder
from flask_restless import APIManager
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy.ext.automap import automap_base
from sqlalchemy.orm import Session
from sqlalchemy import create_engine
from sqlalchemy import Boolean, Column, Date, DateTime, Integer, MetaData, Numeric, Table, Text

import logging
logging.basicConfig(level=logging.DEBUG)

with open('secrets.json') as f:
    secrets = json.load(f)
    connect_str = secrets['docker_database']['connect_str']

app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = connect_str
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False

db = SQLAlchemy(app)
Base = automap_base()

metadata = MetaData(bind=db)

Base.prepare(db.engine, reflect=True)

db.session.commit()

BuildingPermits = Base.classes.building_permits
Census = Base.classes.census
CensusMarginOfError = Base.classes.census_margin_of_error
Crime = Base.classes.crime
DcTax = Base.classes.dc_tax
Project = Base.classes.project
ReacScore = Base.classes.reac_score
RealProperty = Base.classes.real_property
Subsidy = Base.classes.subsidy
Topa = Base.classes.topa
WmataDist = Base.classes.wmata_dist
WmataInfo = Base.classes.wmata_info

models = [BuildingPermits, Census, CensusMarginOfError, Crime, DcTax, Project, ReacScore,
          RealProperty, Subsidy, Topa, WmataDist, WmataInfo
          ]

db.init_app(app)


manager = APIManager(app, flask_sqlalchemy_db=db)

for model in models:
    # https://github.com/jfinkels/flask-restless/pull/436
    model.__tablename__ = model.__table__.name
    manager.create_api(model, methods=['GET'])


@app.route('/')
def hello():
    return("The Housing Insights API Rules!")


if __name__ == '__main__':
    app.run(host='0.0.0.0', port=5001)

@@ -585,16 +585,24 @@
 r'%5D%0A%0Aapp
+lication
  = Flask
@@ -611,24 +611,32 @@
 _name__)%0Aapp
+lication
 .config%5B'SQL
@@ -675,16 +675,24 @@
 _str%0Aapp
+lication
 .config%5B
@@ -753,16 +753,24 @@
 hemy(app
+lication
 )%0ABase =
@@ -1482,16 +1482,24 @@
 _app(app
+lication
 )%0A%0A%0Amana
@@ -1518,16 +1518,24 @@
 ager(app
+lication
 , flask_
@@ -1732,16 +1732,24 @@
 )%0A%0A%0A@app
+lication
 .route('
@@ -1847,16 +1847,24 @@
 %0A    app
+lication
 .run(hos

Rename app to application for elastic beanstalk