wemake-services/django-split-settings

docs: What is the intended way of accessing settings?

stevenengland opened this issue · 2 comments

Hi at all,

could you please confirm that even when using django-split-settings the intended way to access (merged) configuration vars is still this?

from django.conf import settings

print(settings.SOME_ARBITRARY_SETTING)
#^--- prints the the actual value, setting key is accessable

It is not explicitly stated in the docs and I wonder if it is the correct way. Because every var that is not a native Django var (like SECRET_KEY) will not be recognized by mypy (and that way I think my underlying question is connected to #441):

# mypy complaint:
'Settings' object has no attribute 'SOME_ARBITRARY_SETTING'  [misc]

This key is specified in a file like in your examples:

from split_settings.tools import optional, include

include(
    'components/base.py',
    'components/arbitrary.py', # <-- here
    optional('local_settings.py')
)

Because of the question concering the docs I leave this issue open. For the actual issue related in my description I opened another one that might be better targeted towards the cookiecutter template: wemake-services/wemake-django-template#2148

Thanks for the report, there's nothing I can do in this repo. It is a django-stubs bug. It is known and I hope will be fixed soon.