summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorPaweł Marczewski <pwmarcz@gmail.com>2016-11-05 12:31:37 +0100
committerTim Graham <timograham@gmail.com>2016-11-10 07:50:49 -0500
commit50f9e736fa701664c5659d0653aff75b7f4489b6 (patch)
treed19a19558e570cef0d6f24786214eb421a69f304 /django
parent373c6c409c310cb61e1e9c9aff4adba379ffd0b4 (diff)
Fixed #27438 -- Added the diffsettings --default option.
Diffstat (limited to 'django')
-rw-r--r--django/core/management/commands/diffsettings.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/django/core/management/commands/diffsettings.py b/django/core/management/commands/diffsettings.py
index 7bae48c218..3a5ebcf845 100644
--- a/django/core/management/commands/diffsettings.py
+++ b/django/core/management/commands/diffsettings.py
@@ -18,16 +18,24 @@ class Command(BaseCommand):
'--all', action='store_true', dest='all', default=False,
help='Display all settings, regardless of their value. Default values are prefixed by "###".',
)
+ parser.add_argument(
+ '--default', dest='default', metavar='MODULE', default=None,
+ help=(
+ "The settings module to compare the current settings against. Leave empty to "
+ "compare against Django's default settings."
+ ),
+ )
def handle(self, **options):
# Inspired by Postfix's "postconf -n".
- from django.conf import settings, global_settings
+ from django.conf import settings, Settings, global_settings
# Because settings are imported lazily, we need to explicitly load them.
settings._setup()
user_settings = module_to_dict(settings._wrapped)
- default_settings = module_to_dict(global_settings)
+ default = options['default']
+ default_settings = module_to_dict(Settings(default) if default else global_settings)
output = []
for key in sorted(user_settings):