Beispiel #1
0
def create_app():
    app = Flask(__name__)
    config_app(app)
    config_logging(app)

    bp_api = Blueprint('api', __name__, static_folder='static')
    api.init_app(bp_api, fn_user_role=user_role)
    api.config(app.config)
    if app.config.get("ALLOW_CORS"):
        config_cors(app)

    cache.init_app(app)
    mail.init_app(app)

    config_validater(app)
    config_view(app)
    config_api(app)
    config_db(app)
    config_error_handler(app)
    config_before_handler(app)
    config_after_handler(app)

    app.register_blueprint(bp_api, url_prefix='/api')

    return app
Beispiel #2
0
def create_app():
    app = Flask(__name__)
    config_app(app)
    bp_api = Blueprint('api', __name__, static_folder='static')
    api_config = {
        "bootstrap": "/static/lib/bootstrap.css",
        "permission_path": "config/permission.json",
        "auth_secret": "auth_secret",
    }
    api.init_app(bp_api, **api_config)

    config_validater(app)
    config_view(app)
    config_api(app)
    config_db(app)
    config_error_handler(app)
    config_before_handler(app)

    app.register_blueprint(bp_api, url_prefix='/api')
    return app