A simple framework for building complex web applications.
—
Quality
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Blueprints allow you to organize your Flask application into modular components. They provide a way to group related views, templates, and static files.
class Blueprint:
def __init__(
self,
name: str,
import_name: str,
static_folder: str | None = None,
static_url_path: str | None = None,
template_folder: str | None = None,
url_prefix: str | None = None,
subdomain: str | None = None,
url_defaults: dict | None = None,
root_path: str | None = None,
cli_group: str | None = None,
): ...
def route(self, rule: str, **options) -> Callable: ...
def before_request(self, f: Callable) -> Callable: ...
def after_request(self, f: Callable) -> Callable: ...from flask import Blueprint, render_template
# Create blueprint
auth_bp = Blueprint('auth', __name__, url_prefix='/auth')
@auth_bp.route('/login')
def login():
return render_template('auth/login.html')
@auth_bp.route('/logout')
def logout():
return 'Logged out'
# Register with app
app.register_blueprint(auth_bp)Install with Tessl CLI
npx tessl i tessl/pypi-flask