Allow project_root_path and verbosity to come from Django settings
And still fallback to DJANGO_SETTINGS_MODULE environ for project_root_path if not explicitly set Fixes #203
This commit is contained in:
1 parent
c2ad3e6aeb
commit
88a7b0812a
1 file changed
+6
-10
@@ -132,15 +132,6 @@ class Command(BaseCommand):
|
|||||||
register_linting_configuration_options(parser)
|
register_linting_configuration_options(parser)
|
||||||
|
|
||||||
def handle(self, *args, **options):
|
def handle(self, *args, **options):
|
||||||
if options["project_root_path"]:
|
|
||||||
settings_path = options["project_root_path"]
|
|
||||||
else:
|
|
||||||
settings_path = os.path.dirname(
|
|
||||||
import_module(os.getenv("DJANGO_SETTINGS_MODULE")).__file__
|
|
||||||
)
|
|
||||||
|
|
||||||
configure_logging(options["verbosity"])
|
|
||||||
|
|
||||||
django_settings_options = self.read_django_settings(options)
|
django_settings_options = self.read_django_settings(options)
|
||||||
config_options = self.read_config_file(options)
|
config_options = self.read_config_file(options)
|
||||||
toml_options = self.read_toml_file(options)
|
toml_options = self.read_toml_file(options)
|
||||||
@@ -157,8 +148,13 @@ class Command(BaseCommand):
|
|||||||
all_warnings_as_errors,
|
all_warnings_as_errors,
|
||||||
) = extract_warnings_as_errors_option(options["warnings_as_errors"])
|
) = extract_warnings_as_errors_option(options["warnings_as_errors"])
|
||||||
|
|
||||||
|
configure_logging(options["verbosity"])
|
||||||
|
|
||||||
|
root_path = options["project_root_path"] or os.path.dirname(
|
||||||
|
import_module(os.getenv("DJANGO_SETTINGS_MODULE")).__file__
|
||||||
|
)
|
||||||
linter = MigrationLinter(
|
linter = MigrationLinter(
|
||||||
settings_path,
|
root_path,
|
||||||
ignore_name_contains=options["ignore_name_contains"],
|
ignore_name_contains=options["ignore_name_contains"],
|
||||||
ignore_name=options["ignore_name"],
|
ignore_name=options["ignore_name"],
|
||||||
include_name_contains=options["include_name_contains"],
|
include_name_contains=options["include_name_contains"],
|
||||||
|
|||||||
Reference in new issue
Block a user