Fix import of ImproperlyConfigured in app_settings
Global import does not work in app_setings files.
This commit is contained in:
parent
957aae3ff7
commit
926accba9e
|
@ -1,7 +1,3 @@
|
|||
import sys
|
||||
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
|
||||
|
||||
class AppSettings(object):
|
||||
'''Thanks django-allauth'''
|
||||
|
@ -12,6 +8,8 @@ class AppSettings(object):
|
|||
|
||||
def _setting(self, name, dflt=__SENTINEL):
|
||||
from django.conf import settings
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
|
||||
v = getattr(settings, self.prefix + name, dflt)
|
||||
if v is self.__SENTINEL:
|
||||
raise ImproperlyConfigured('Missing setting %r' % (self.prefix + name))
|
||||
|
@ -58,6 +56,8 @@ class AppSettings(object):
|
|||
return self._setting('MORE_URL', 'https://mon.service-public.fr/')
|
||||
|
||||
|
||||
import sys
|
||||
|
||||
app_settings = AppSettings('A2_MSP_')
|
||||
app_settings.__name__ = __name__
|
||||
sys.modules[__name__] = app_settings
|
||||
|
|
Reference in New Issue