You can use the MVC pattern in your Flask application using this extension.
Run the follow command to install mvc_flask
:
$ pip install mvc_flask
To start the mvc_flask
you need to import and register in your application.
from flask import Flask
from mvc_flask import FlaskMVC
app = Flask(__name__)
FlaskMVC(app)
Or use application factories
, e.g:
mvc = FlaskMVC()
def create_app():
...
mvc.init_app(app)
By default the mvc_flask
assumes that your application directory will be app
and if it doesn't exist, create it!
If you can use other directories, you can use the path
parameter when the instance of FlaskMVC is initialized. E.g:
mvc = FlaskMVC()
def create_app():
...
mvc.init_app(app, path='src')
Now, you can use src
as default directory for prepare your application.
You structure should be look like this:
app
├── __ini__.py
├── controllers
│ └── home_controller.py
├── routes.py
└── views
├── index.html
Please visit the documentation to check more details https://marcuxyz.github.io/mvc-flask
- Major Test Refactor: Converted all test files from class-based to function-based structure for improved readability and maintainability
- Comprehensive Test Coverage: Enhanced test coverage across all major components including:
- Controllers (CRUD operations, error handling, integration workflows)
- Callbacks (middleware system, hooks, configuration)
- Helpers (HTML input method helpers, method override functionality)
- Integration (complete workflows, performance, security)
- Version management (semantic versioning, metadata validation)
- Test Organization: Reorganized test files with clear naming convention using
test_*_functional.py
pattern - Performance Testing: Added comprehensive performance benchmarking and optimization validation
- Security Testing: Enhanced security validation including CSRF protection, method override security, and input sanitization
- Comment Cleanup: Removed unnecessary comments throughout test codebase while preserving critical documentation
- English Standardization: Ensured all code, comments, and documentation use native American English
- Test Utilities: Improved test helper functions and utilities for better test maintainability
- Error Handling: Enhanced error handling validation across all test scenarios
- Improved Readability: Function-based tests are more straightforward to read and understand
- Better Isolation: Each test function is completely isolated, reducing interdependencies
- Faster Development: Simplified test structure enables faster test development and debugging
- Enhanced Documentation: Added comprehensive test documentation outlining best practices and patterns
- Memory Optimization: Added memory usage stability testing to prevent memory leaks
- Concurrent Testing: Enhanced concurrent access simulation and testing
- Configuration Testing: Comprehensive testing across different Flask configuration scenarios
- Scalability Validation: Added large dataset handling and scalability characteristic testing
- All existing test functionality remains intact
- No breaking changes to core MVC Flask functionality
- Test execution performance improved due to simplified structure
- Enhanced debugging capabilities with clearer test failure reporting
This release significantly improves the development experience and code quality while maintaining full backward compatibility with existing applications.