diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2015-10-15 22:03:25 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-12-18 19:08:28 -0500 |
| commit | 24ebf17f04ee0ed157c430ff7d10ec0728abd48e (patch) | |
| tree | 880cc3f980722dccbd7eed5ae03988f6a5043142 /django | |
| parent | f0a4ff2b118cbc3b7f9ac28a7d9e355288b546c0 (diff) | |
[1.9.x] Fixed #25510 -- Allowed runserver to start with incorrect INSTALLED_APPS.
In that case, the content of INSTALLED_APPS will be ignored until it's
fixed and the autoreloader kicks in. I confirmed this behavior manually.
As explained on the ticket it's hard to write a test for this case.
Backport of df0a446fd4c864c003e4f941b5b7abd6f10c9427 from master
Diffstat (limited to 'django')
| -rw-r--r-- | django/core/management/__init__.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/django/core/management/__init__.py b/django/core/management/__init__.py index dec7c052b3..2a7d95d432 100644 --- a/django/core/management/__init__.py +++ b/django/core/management/__init__.py @@ -1,9 +1,9 @@ from __future__ import unicode_literals -import collections import os import pkgutil import sys +from collections import OrderedDict, defaultdict from importlib import import_module import django @@ -144,7 +144,7 @@ class ManagementUtility(object): "", "Available subcommands:", ] - commands_dict = collections.defaultdict(lambda: []) + commands_dict = defaultdict(lambda: []) for name, app in six.iteritems(get_commands()): if app == 'django.core': app = 'django' @@ -316,8 +316,11 @@ class ManagementUtility(object): autoreload.check_errors(django.setup)() except Exception: # The exception will be raised later in the child process - # started by the autoreloader. - pass + # started by the autoreloader. Pretend it didn't happen by + # loading an empty list of applications. + apps.all_models = defaultdict(OrderedDict) + apps.app_configs = OrderedDict() + apps.apps_ready = apps.models_ready = apps.ready = True # In all other cases, django.setup() is required to succeed. else: |
