validator
django_spire.core.management.commands.spire_startapp_pkg.validator
AppValidator
Validates Django app paths and configurations.
This class performs validation checks to ensure app paths are properly formatted, don't conflict with existing apps, and use valid root apps.
Initializes the validator with required dependencies.
Parameters:
-
reporter(Reporter) –Reporter for displaying error messages.
-
registry(AppRegistry) –Registry for checking installed apps.
-
path_resolver(PathResolver) –Path resolver for determining file locations.
-
filesystem(FileSystem) –File system for checking file existence.
Source code in django_spire/core/management/commands/spire_startapp_pkg/validator.py
validate_app_format
Validates that an app path uses dot notation.
Parameters:
-
app_path(str) –App path to validate.
Raises:
-
CommandError–If the app path doesn't contain dots.
Source code in django_spire/core/management/commands/spire_startapp_pkg/validator.py
validate_app_path
Validates that an app path doesn't already exist.
Parameters:
Raises:
-
CommandError–If an app already exists at the destination path.
Source code in django_spire/core/management/commands/spire_startapp_pkg/validator.py
validate_root_app
Validates that the root app component is registered in Django.
Parameters:
Raises:
-
CommandError–If the root app is not a valid registered app.