def patch_settings(config_data):
import django<EOL>current_django_version = LooseVersion(django.__version__)<EOL>declared_django_version = LooseVersion(config_data.django_version)<EOL>if not os.path.exists(config_data.settings_path):<EOL><INDENT>sys.stderr.write(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'.format(config_data.settings_path)<EOL>)<EOL>return sys.exit(<NUM_LIT:5>)<EOL><DEDENT>if current_django_version.version[:<NUM_LIT:2>] != declared_django_version.version[:<NUM_LIT:2>]:<EOL><INDENT>sys.stderr.write(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT:\n>'.format(<EOL>current_django_version, declared_django_version<EOL>)<EOL>)<EOL>return sys.exit(<NUM_LIT:9>)<EOL><DEDENT>overridden_settings = (<EOL>'<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>', '<STR_LIT>', '<STR_LIT>'<EOL>)<EOL>extra_settings = '<STR_LIT>'<EOL>with open(config_data.settings_path, '<STR_LIT:r>') as fd_original:<EOL><INDENT>original = fd_original.read()<EOL><DEDENT>if config_data.extra_settings and os.path.exists(config_data.extra_settings):<EOL><INDENT>with open(config_data.extra_settings, '<STR_LIT:r>') as fd_extra:<EOL><INDENT>extra_settings = fd_extra.read()<EOL><DEDENT><DEDENT>original = original.replace('<STR_LIT>', '<STR_LIT>')<EOL>if config_data.aldryn:  <EOL><INDENT>DATA_DIR = (<EOL>'<STR_LIT>'<EOL>)<EOL>STATICFILES_DIR = '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>DATA_DIR = '<STR_LIT>'<EOL>STATICFILES_DIR = '<STR_LIT>'.format(<EOL>config_data.project_name<EOL>)<EOL><DEDENT>original = data.DEFAULT_PROJECT_HEADER + DATA_DIR + original<EOL>original += '<STR_LIT>'<EOL>original += '<STR_LIT>'<EOL>original += '<STR_LIT>'<EOL>original +=
Modify the settings file created by Django injecting the django CMS
configuration

:param config_data: configuration data