Project Structure
Blueprints
Enferno uses a three-blueprint architecture for better organization and security:1. Portal Blueprint (portal/)
Usually contains protected routes that require authentication. Enferno uses a pattern of protecting all routes in this blueprint automatically using before_request:
2. User Blueprint (user/)
Handles user management, authentication, and profile-related routes:
3. Public Blueprint (public/)
Contains routes that are publicly accessible without authentication:
Database Operations
Enferno uses SQLAlchemy 2.x with the Flask-SQLAlchemy extension. Thedb instance is available from enferno.extensions.
Model Definition
Database Operations
Task Queue
Enferno uses Celery for background tasks. Tasks are defined inenferno/tasks/__init__.py:
API Development
API endpoints are defined inapp/api/. Enferno follows RESTful principles.
Development Server
Run the development server with:Security Best Practices
-
Input Validation
-
CSRF Protection
-
Authentication
Debugging
Enferno includes several debugging tools:-
Flask Debug Toolbar
-
Logging
-
Database Debugging