def test_01_custom_app(self): app_loader._modules = [] app_loader.enable_autoload() app_loader.get_app_modules(['testapp']) app_loader.load_modules() self.assertIn('testapp', app_loader.config.apps) self.assertIn('GOOGLE_ANALYTICS_SITE_SPEED', app_loader.config.config) self.assertIsInstance(app_loader.config.config, dict) with self.assertRaises(KeyError): app_loader.config.hovno # just propagate all loaded modules to settings modules = app_loader.get_modules() self.assertEqual(len(app_loader.modules), 4) #self.assertIn('leonardo_multisite', app_loader.modules[1][1].apps) testapp, config = modules[0] self.assertEqual(config.module, testapp) self.assertIn('testapp', config.apps)
def test_01_app_loader(self): app_loader.disable_autoload() self.assertEqual(len(app_loader.modules), 1) modules = app_loader.get_modules() self.assertEqual(settings.LEONARDO_MODULES, modules) testapp, config = modules[0] self.assertEqual(hasattr(config, 'apps'), True) self.assertIn('testapp', config.apps) self.assertIn('testapp', config.module_name) self.assertIn('testapp', config.name)
from app_loader import app_loader APPS = ['testapp'] # disable autoload app_loader.disable_autoload() # load directly specified apps app_loader.get_app_modules(APPS) # load all modules app_loader.load_modules() # just propagate all loaded modules to settings LEONARDO_MODULES = app_loader.get_modules() # override all try: from local_settings import * except ImportError: pass