mirror of https://github.com/django/django.git
Report wrongly-typed settings and abort, as originally planned.
Thanks Claude for the heads up. Refs #12493 and commit 5e08b792
.
This commit is contained in:
parent
5e3a6532aa
commit
64cdea68e7
|
@ -132,9 +132,17 @@ class Settings(BaseSettings):
|
||||||
% (self.SETTINGS_MODULE, e)
|
% (self.SETTINGS_MODULE, e)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
tuple_settings = ("INSTALLED_APPS", "TEMPLATE_DIRS")
|
||||||
|
|
||||||
for setting in dir(mod):
|
for setting in dir(mod):
|
||||||
if setting == setting.upper():
|
if setting == setting.upper():
|
||||||
setting_value = getattr(mod, setting)
|
setting_value = getattr(mod, setting)
|
||||||
|
|
||||||
|
if setting in tuple_settings and \
|
||||||
|
isinstance(setting_value, six.string_types):
|
||||||
|
raise ImproperlyConfigured("The %s setting must be a tuple. "
|
||||||
|
"Please fix your settings." % setting)
|
||||||
|
|
||||||
setattr(self, setting, setting_value)
|
setattr(self, setting, setting_value)
|
||||||
|
|
||||||
if not self.SECRET_KEY:
|
if not self.SECRET_KEY:
|
||||||
|
|
Loading…
Reference in New Issue