Skip to content

Instantly share code, notes, and snippets.

@msabramo
Created October 12, 2011 07:12
Show Gist options
  • Save msabramo/1280513 to your computer and use it in GitHub Desktop.
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
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))
$ 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
@msabramo
Copy link
Author

Created a ticket to add this to Django core: https://code.djangoproject.com/ticket/17037

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment