Created
October 12, 2011 07:12
-
-
Save msabramo/1280513 to your computer and use it in GitHub Desktop.
A super simple but useful Django management command to print the active project settings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.core.management.base import BaseCommand | |
from django.conf import settings | |
class Command(BaseCommand): | |
help = "Print the active Django settings." | |
def handle(self, *args, **options): | |
for key in dir(settings): | |
if key.startswith('__'): | |
continue | |
value = getattr(settings, key) | |
print('%-40s : %s' % (key, value)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ django print_settings | egrep 'DEBUG|INSTALLED_APPS' | egrep -v 'AUTH|LOGGING' | |
DEBUG : True | |
DEBUG_PROPAGATE_EXCEPTIONS : False | |
DEBUG_TOOLBAR_CONFIG : {'INTERCEPT_REDIRECTS': False} | |
INSTALLED_APPS : ['django.contrib.auth', 'django.contrib.contenttypes', | |
'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.admin', | |
'django.contrib.staticfiles', 'djcelery', 'django_coverage', 'django_extensions', | |
'debug_toolbar', 'south'] | |
TEMPLATE_DEBUG : True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Blogged at http://marc-abramowitz.com/archives/2011/10/12/a-super-simple-and-useful-custom-django-management-command/