nordabiz/blueprints/__init__.py
Maciej Pienczyn 66856a697d refactor(phase1): Extract blueprints for reports, contacts, classifieds, calendar
Phase 1 of app.py refactoring - reducing from ~14,455 to ~13,699 lines.

New structure:
- blueprints/reports/ - 4 routes (/raporty/*)
- blueprints/community/contacts/ - 6 routes (/kontakty/*)
- blueprints/community/classifieds/ - 4 routes (/tablica/*)
- blueprints/community/calendar/ - 3 routes (/kalendarz/*)
- utils/ - decorators, helpers, notifications, analytics
- extensions.py - Flask extensions (csrf, login_manager, limiter)
- config.py - environment configurations

Updated templates with blueprint-prefixed url_for() calls.

⚠️ DO NOT DEPLOY before presentation on 2026-01-30 19:00

Tested on DEV: all endpoints working correctly.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 10:10:45 +01:00

54 lines
1.6 KiB
Python

"""
Blueprints Package
==================
Central registration of all Flask blueprints.
"""
import logging
logger = logging.getLogger(__name__)
def register_blueprints(app):
"""
Register all blueprints with the Flask application.
Args:
app: Flask application instance
"""
# Phase 1: Low-risk modules
# Reports blueprint
try:
from blueprints.reports import bp as reports_bp
app.register_blueprint(reports_bp)
logger.info("Registered blueprint: reports")
except ImportError as e:
logger.debug(f"Blueprint reports not yet available: {e}")
# Community blueprints - register directly (not nested)
# to preserve endpoint names like 'calendar_index' instead of 'community.calendar.calendar_index'
try:
from blueprints.community.contacts import bp as contacts_bp
app.register_blueprint(contacts_bp)
logger.info("Registered blueprint: contacts")
except ImportError as e:
logger.debug(f"Blueprint contacts not yet available: {e}")
try:
from blueprints.community.classifieds import bp as classifieds_bp
app.register_blueprint(classifieds_bp)
logger.info("Registered blueprint: classifieds")
except ImportError as e:
logger.debug(f"Blueprint classifieds not yet available: {e}")
try:
from blueprints.community.calendar import bp as calendar_bp
app.register_blueprint(calendar_bp)
logger.info("Registered blueprint: calendar")
except ImportError as e:
logger.debug(f"Blueprint calendar not yet available: {e}")
# Phase 2-7: Future blueprints will be added here