Ticket #19724: 19724-1.diff

File 19724-1.diff, 851 bytes (added by claudep, 2 years ago)

Ouptut error message on sys.stderr if settings contain errors

  • django/core/management/__init__.py

    diff --git a/django/core/management/__init__.py b/django/core/management/__init__.py
    index 7638937..b2c4f46 100644
    a b def get_commands(): 
    107107        from django.conf import settings
    108108        try:
    109109            apps = settings.INSTALLED_APPS
    110         except ImproperlyConfigured:
     110        except ImproperlyConfigured as e:
    111111            # Still useful for commands that do not require functional settings,
    112112            # like startproject or help
    113113            apps = []
     114            sys.stderr.write(color_style().ERROR(
     115                "Project settings contain errors (%s)\n"
     116                "Only core Django commands will be available.\n" % e))
    114117
    115118        # Find and load the management module for each installed app.
    116119        for app_name in apps:
Back to Top