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>
29 lines
760 B
Python
29 lines
760 B
Python
"""
|
|
Flask Extensions
|
|
================
|
|
|
|
Centralized Flask extension instances.
|
|
Extensions are initialized without app, then configured in create_app().
|
|
|
|
This pattern allows blueprints to import extensions without circular imports.
|
|
"""
|
|
|
|
from flask_wtf.csrf import CSRFProtect
|
|
from flask_login import LoginManager
|
|
from flask_limiter import Limiter
|
|
from flask_limiter.util import get_remote_address
|
|
|
|
# CSRF Protection
|
|
csrf = CSRFProtect()
|
|
|
|
# Login Manager
|
|
login_manager = LoginManager()
|
|
login_manager.login_view = 'auth.login'
|
|
login_manager.login_message = 'Zaloguj się, aby uzyskać dostęp do tej strony.'
|
|
|
|
# Rate Limiter (storage configured in create_app)
|
|
limiter = Limiter(
|
|
key_func=get_remote_address,
|
|
default_limits=["200 per day", "50 per hour"]
|
|
)
|