import os import connexion from flask_sqlalchemy import SQLAlchemy from flask_marshmallow import Marshmallow basedir = os.path.abspath(os.path.dirname(__file__)) # Creates the Connexion application instance connex_app = connexion.App(__name__, specification_dir=basedir) # Gets the underlying Flask app instance app = connex_app.app database_uri = "sqlite:////" + os.path.join(basedir, "readings.db") # Configures the SQLAlchemy part of the app instance app.config["SQLALCHEMY_ECHO"] = True # Set to false in prod. app.config["SQLALCHEMY_DATABASE_URI"] = database_uri app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False # Creates the SQLAlchemy db instance db = SQLAlchemy(app) # Initialises Marshmallow ma = Marshmallow(app)