django-compressor / django-appconf

An app to handle configuration defaults of packaged Django apps gracefully
https://django-appconf.readthedocs.io
BSD 3-Clause "New" or "Revised" License
350 stars 47 forks source link

Update prefixing of names starting with underscore #99

Closed paduszyk closed 2 months ago

paduszyk commented 2 months ago

Currently, all the names defined within AppConf are prefixed in the same way when accessed from django.conf.settings. For:

class MyAppConf(AppConf):
    PUBLIC_SETTING = ...

    _PRIVATE_SETTING = ...

    class Meta:
        prefix = "my_app"

PUBLIC_SETTING can be accessed by MY_APP_PUBLIC_SETTING, whereas _PRIVATE_SETTING goes as MY_APP__PRIVATE_SETTING.

I think that an alternative way for the second case would be to add an underscore before the full (i.e. prefixed by the AppConf.Meta prefix) name. So finally this would be: _MY_APP_PRIVATE_SETTING.

Why is this better? IMO, this preserves the "privacy" of the original AppConf attribute.

Alternatively underscore-prefixed settings can be set as inaccessible from the django.conf.settings (see #98).

carltongibson commented 2 months ago

See comment on #98. I'll close this as a duplicate to be honest.