importcopyfromdjango.confimportsettingsfrom.importError,Tags,registerE001=Error("You have 'APP_DIRS': True in your TEMPLATES but also specify 'loaders' ""in OPTIONS. Either remove APP_DIRS or remove the 'loaders' option.",id='templates.E001',)E002=Error("'string_if_invalid' in TEMPLATES OPTIONS must be a string but got: {} ({}).",id="templates.E002",)@register(Tags.templates)defcheck_setting_app_dirs_loaders(app_configs,**kwargs):return[E001]ifany(conf.get('APP_DIRS')and'loaders'inconf.get('OPTIONS',{})forconfinsettings.TEMPLATES)else[]@register(Tags.templates)defcheck_string_if_invalid_is_string(app_configs,**kwargs):errors=[]forconfinsettings.TEMPLATES:string_if_invalid=conf.get('OPTIONS',{}).get('string_if_invalid','')ifnotisinstance(string_if_invalid,str):error=copy.copy(E002)error.msg=error.msg.format(string_if_invalid,type(string_if_invalid).__name__)errors.append(error)returnerrors