def _build_settings(config_data):
spacer = '<STR_LIT:U+0020>'<EOL>text = []<EOL>vars = get_settings()<EOL>vars.MIDDLEWARE_CLASSES.insert(<NUM_LIT:0>, vars.APPHOOK_RELOAD_MIDDLEWARE_CLASS)<EOL>processors = vars.TEMPLATE_CONTEXT_PROCESSORS + vars.TEMPLATE_CONTEXT_PROCESSORS_3<EOL>text.append(data.TEMPLATES_1_8.format(<EOL>loaders=('<STR_LIT>' + spacer * <NUM_LIT:4>).join([<EOL>"<STR_LIT>".format(var) for var in vars.TEMPLATE_LOADERS<EOL>if (<EOL>LooseVersion(config_data.django_version) < LooseVersion('<STR_LIT>') or<EOL>'<STR_LIT>' not in var<EOL>)<EOL>]),<EOL>processors=('<STR_LIT>' + spacer * <NUM_LIT:4>).join(["<STR_LIT>".format(var) for var in processors]),<EOL>dirs="<STR_LIT>".format(config_data.project_name)<EOL>))<EOL>if LooseVersion(config_data.django_version) >= LooseVersion('<STR_LIT>'):<EOL><INDENT>text.append('<STR_LIT>'.format(<EOL>spacer, ('<STR_LIT>' + spacer).join(['<STR_LIT>'.format(var)<EOL>for var in vars.MIDDLEWARE_CLASSES])<EOL>))<EOL><DEDENT>else:<EOL><INDENT>text.append('<STR_LIT>'.format(<EOL>spacer, ('<STR_LIT>' + spacer).join(["<STR_LIT>".format(var)<EOL>for var in vars.MIDDLEWARE_CLASSES])<EOL>))<EOL><DEDENT>apps = list(vars.INSTALLED_APPS)<EOL>apps = list(vars.CMS_3_HEAD) + apps<EOL>apps.extend(vars.TREEBEARD_APPS)<EOL>apps.extend(vars.CMS_3_APPLICATIONS)<EOL>if not config_data.no_plugins:<EOL><INDENT>apps.extend(vars.FILER_PLUGINS_3)<EOL><DEDENT>if config_data.aldryn:  <EOL><INDENT>apps.extend(vars.ALDRYN_APPLICATIONS)<EOL><DEDENT>if config_data.reversion and LooseVersion(config_data.cms_version) < LooseVersion('<STR_LIT>'):<EOL><INDENT>apps.extend(vars.REVERSION_APPLICATIONS)<EOL><DEDENT>text.append('<STR_LIT>'.format(<EOL>spacer, ('<STR_LIT>' + spacer).join(['<STR_LIT>'.format(var) for var in apps] +<EOL>['<STR_LIT>'.format(config_data.project_name)])<EOL>))<EOL>text.append('<STR_LIT>'.format(<EOL>spacer, '<STR_LIT>',<EOL>('<STR_LIT:\n>' + spacer).join(['<STR_LIT>'.format(item) for item in config_data.languages])  <EOL>))<EOL>cms_langs = deepcopy(vars.CMS_LANGUAGES)<EOL>for lang in config_data.languages:<EOL><INDENT>lang_dict = {'<STR_LIT:code>': lang, '<STR_LIT:name>': lang}<EOL>lang_dict.update(copy(cms_langs['<STR_LIT:default>']))<EOL>cms_langs[<NUM_LIT:1>].append(lang_dict)<EOL><DEDENT>cms_text = ['<STR_LIT>']<EOL>cms_text.append('<STR_LIT>'.format(spacer, '<STR_LIT>'))<EOL>for key, value in iteritems(cms_langs):<EOL><INDENT>if key == '<STR_LIT:default>':<EOL><INDENT>cms_text.append('<STR_LIT>'.format(spacer, key))<EOL>for config_name, config_value in iteritems(value):<EOL><INDENT>cms_text.append('<STR_LIT>'.format(spacer * <NUM_LIT:2>, config_name, config_value))<EOL><DEDENT>cms_text.append('<STR_LIT>'.format(spacer))<EOL><DEDENT>else:<EOL><INDENT>cms_text.append('<STR_LIT>'.format(spacer, key))<EOL>for lang in value:<EOL><INDENT>cms_text.append('<STR_LIT>'.format(spacer * <NUM_LIT:2>))<EOL>for config_name, config_value in iteritems(lang):<EOL><INDENT>if config_name == '<STR_LIT:code>':<EOL><INDENT>cms_text.append('<STR_LIT>'.format(spacer * <NUM_LIT:3>, config_name, config_value))  <EOL><DEDENT>elif config_name == '<STR_LIT:name>':<EOL><INDENT>cms_text.append('<STR_LIT>'.format(spacer * <NUM_LIT:3>, config_name, config_value))  <EOL><DEDENT>else:<EOL><INDENT>cms_text.append('<STR_LIT>'.format(<EOL>spacer * <NUM_LIT:3>, config_name, config_value<EOL>))<EOL><DEDENT><DEDENT>cms_text.append('<STR_LIT>'.format(spacer * <NUM_LIT:2>))<EOL><DEDENT>cms_text.append('<STR_LIT>'.format(spacer))<EOL><DEDENT><DEDENT>cms_text.append('<STR_LIT:}>')<EOL>text.append('<STR_LIT:\n>'.join(cms_text))<EOL>if config_data.bootstrap:<EOL><INDENT>cms_templates = '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>cms_templates = '<STR_LIT>'<EOL><DEDENT>text.append('<STR_LIT>'.format(<EOL>spacer, '<STR_LIT>',<EOL>('<STR_LIT>' + spacer).join(<EOL>['<STR_LIT>'.format(*item) for item in getattr(vars, cms_templates)]<EOL>)<EOL>))<EOL>text.append('<STR_LIT>'.format(vars.CMS_PERMISSION))<EOL>text.append('<STR_LIT>'.format(vars.CMS_PLACEHOLDER_CONF))<EOL>database = ['<STR_LIT>'.format(key, format_val(val)) for key, val in sorted(config_data.db_parsed.items(), key=lambda x: x[<NUM_LIT:0>])]  <EOL>text.append(textwrap.dedent("""<STR_LIT>""").strip().format(('<STR_LIT>' + spacer * <NUM_LIT:2>).join(database)))  <EOL>DJANGO_MIGRATION_MODULES = _detect_migration_layout(vars, apps)<EOL>text.append('<STR_LIT>'.format(<EOL>spacer, ('<STR_LIT>' + spacer).join(<EOL>['<STR_LIT>'.format(*item) for item in DJANGO_MIGRATION_MODULES.items()]<EOL>)<EOL>))<EOL>if config_data.filer:<EOL><INDENT>text.append('<STR_LIT>'.format(<EOL>spacer, ('<STR_LIT>' + spacer).join(<EOL>['<STR_LIT>'.format(var) for var in vars.THUMBNAIL_PROCESSORS]<EOL>)<EOL>))<EOL><DEDENT>return '<STR_LIT>'.join(text)<EOL>
Build the django CMS settings dictionary

:param config_data: configuration data