def get_project_settings(): projects = {} for project in settings.SETTINGS: project_settings = {} regex, modules = settings.SETTINGS[project] if not isinstance(modules, (tuple, list)): modules = [modules] for module in modules: if isinstance(module, dict): _project_settings = module else: module = import_module(module) _project_settings = dict((k, v) for k, v in module.__dict__.items() if k.isupper() and k[0] != '_') _all_settings = settings.default_settings.__dict__.copy() _all_settings.update(_project_settings) recursive_format(_project_settings, **_all_settings) project_settings.update(_project_settings) project_name, _, project_suffix = project.partition('.') projects[project] = (re.compile(regex), (project_name, project_suffix, project_settings)) return projects
if DEBUG is None: DEBUG = False if TEMPLATE_DEBUG is None: TEMPLATE_DEBUG = False # Jinja2 configuration: JINJA2_TEMPLATE_LOADERS = TEMPLATE_LOADERS if JINJA2_ENABLED: TEMPLATE_LOADERS = ( 'coffin.template.loaders.jinja2.Loader', ) # Setup debug level for logging DEBUG_OR_WARNING = 'DEBUG' if DEBUG else 'WARNING' ################################################################################ # Interpolate `{VAR_NAME}`-like variables in strings in certain settings: from recursiveformat import recursive_format recursive_format(globs, **globs) ################################################################################ if PROJECT_SUFFIX: PROJECT = '%s.%s' % (PROJECT_NAME, PROJECT_SUFFIX) else: PROJECT = PROJECT_NAME