Beispiel #1
0
def create_app(uri):
    """ dynamically create the app """
    app = Flask(__name__, static_url_path='', static_folder='./static')
    app.config['SQLALCHEMY_DATABASE_URI'] = uri
    init_engine(app.config['SQLALCHEMY_DATABASE_URI'])

    @app.teardown_appcontext
    def shutdown_session(exception=None):
        db_session.remove()

    import landing
    app.register_blueprint(landing.app)
    return app
Beispiel #2
0
def create_app(uri):
    """ dynamically create the app """
    app = Flask(__name__, static_url_path="", static_folder="./static")
    app.config["SQLALCHEMY_DATABASE_URI"] = uri
    init_engine(app.config["SQLALCHEMY_DATABASE_URI"])

    @app.teardown_appcontext
    def shutdown_session(exception=None):
        db_session.remove()

    import landing

    app.register_blueprint(landing.app)
    return app
Beispiel #3
0
def create_app(uri):
    """ dynamically create the app """
    app = Flask(__name__)
    app.config['SQLALCHEMY_DATABASE_URI'] = uri
    init_engine(app.config['SQLALCHEMY_DATABASE_URI'])

    @app.teardown_appcontext
    def shutdown_session(exception=None):
        db_session.remove()

    @app.errorhandler(400)
    @app.errorhandler(404)
    @app.errorhandler(405)
    @app.errorhandler(500)
    def default_error_handle(error=None):
        """ handle all errors with json output """
        return jsonify(error=error.code, message=error.message, success=False),\
            error.code

    from inspired_landing.api.users.views import users
    app.register_blueprint(users, url_prefix="/users")
    return app
Beispiel #4
0
def create_app(uri):
    """ dynamically create the app """
    app = Flask(__name__)
    app.config['SQLALCHEMY_DATABASE_URI'] = uri
    init_engine(app.config['SQLALCHEMY_DATABASE_URI'])

    @app.teardown_appcontext
    def shutdown_session(exception=None):
        db_session.remove()

    @app.errorhandler(400)
    @app.errorhandler(404)
    @app.errorhandler(405)
    @app.errorhandler(500)
    def default_error_handle(error=None):
        """ handle all errors with json output """
        return jsonify(error=error.code, message=error.message, success=False),\
            error.code

    from inspired_landing.api.users.views import users
    app.register_blueprint(users, url_prefix="/users")
    return app