Code

Ticket #1371: default_config.patch

File default_config.patch, 844 bytes (added by django@…, 8 years ago)

implements app.default_settings as suggested

  • django/conf/__init__.py

     
    5252            else: 
    5353                new_installed_apps.append(app) 
    5454        self.INSTALLED_APPS = new_installed_apps 
     55         
     56        # install default values from apps 
     57        for app in self.INSTALLED_APPS: 
     58            try: 
     59                dapp = __import__("%s.default_settings" %app, '', '', ['']) 
     60                for setting in dir(dapp): 
     61                    if setting == setting.upper() and not hasattr(self, setting): 
     62                        setattr(self, setting, getattr(dapp, setting)) 
     63            except ImportError: pass 
    5564 
    5665        # move the time zone info into os.environ 
    5766        os.environ['TZ'] = self.TIME_ZONE