Blueprint LoaderΒΆ

The BlueprintLoader class is used to register blueprints with the Flask application using a Blueprint Collector

It needs to be instantiated with the method used to register blueprints with the Flask application and the blueprint collector to use.

from flask_smore_better.blueprint import BlueprintLoader
from flask_smore_better.blueprint import DevBlueprintCollector

from flask import current_app  # We assume this is ran in app context


blueprint_loader = BlueprintLoader(
    current_app.register_blueprint, DevBlueprintCollector()
)

Then you can call the object with the module/package name to load the blueprints from the module/package.

# Register blueprints from my_module.blueprints
blueprint_loader("my_module.blueprints")