"""These are the available settings.All attributes prefixed ``PRODUCTION_*`` can be overridden from your Djangoproject's settings module by defining a setting with the same name."""from__future__importannotationsfromcollections.abcimportMappingfromdataclassesimportdataclass,fieldfromtypingimportAnyfromdjango.confimportsettingsasdjango_settings# All attributes accessed with this prefix are possible to overwrite# through django.conf.settings.SETTINGS_PREFIX="PRODUCTION_"
[docs]@dataclass(frozen=True)classAppSettings:"""Access this instance as `.conf.app_settings`."""PRODUCTION_PROCESSES:Mapping[str,Mapping[str,str]]=field(default_factory=dict)"""Whether the app is enabled (dummy setting to demo usage)."""def__getattribute__(self,__name:str)->Any:""" Check if a Django project settings should override the app default. In order to avoid returning any random properties of the django settings, we inspect the prefix firstly. """if__name.startswith(SETTINGS_PREFIX)andhasattr(django_settings,__name):returngetattr(django_settings,__name)returnsuper().__getattribute__(__name)