wemake-services / django-split-settings

Organize Django settings into multiple files and directories. Easily override and modify settings. Use wildcards and optional settings files.
http://django-split-settings.rtfd.io
BSD 3-Clause "New" or "Revised" License
1.11k stars 67 forks source link

docs: What is the intended way of accessing settings? #470

Closed stevenengland closed 1 year ago

stevenengland commented 1 year ago

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')
)
stevenengland commented 1 year ago

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: https://github.com/wemake-services/wemake-django-template/issues/2148

sobolevn commented 1 year ago

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.