While working on Opal/Django, I noticed the 'diffsettings' command:
http://www.djangoproject.com/documentation/django_admin/#diffsettings
Pyre apps could have a similar feature: dump the differences between the
current configuration and the defaults as a .cfg file.
See also: issue94.
"Talent borrows. Genius steals."
--Oscar Wilde
~~~~
### from django.core.management
def diffsettings():
"""
Displays differences between the current settings.py and Django's
default settings. Settings that don't appear in the defaults are
followed by "###".
"""
# Inspired by Postfix's "postconf -n".
from opal.conf import settings, global_settings
user_settings = _module_to_dict(settings)
default_settings = _module_to_dict(global_settings)
output = []
keys = user_settings.keys()
keys.sort()
for key in keys:
if key not in default_settings:
output.append("%s = %s ###" % (key, user_settings[key]))
elif user_settings[key] != default_settings[key]:
output.append("%s = %s" % (key, user_settings[key]))
print '\n'.join(output)
diffsettings.args = ""
|