def create_app(): db = connect_to_mysql(mysql_url=os.environ['CLEARDB_DATABASE_URL']) preprocess(db=db) db.close() app = Flask(__name__) return app
def listings(): db = connect_to_mysql(mysql_url=os.environ['CLEARDB_DATABASE_URL']) listings = Listings(db=db, request=request) response = jsonify(listings.to_dict()) response.headers['Links'] = listings.pagination_header() db.close() return response