Hello Christian, I'm not aware of any plans in this area.
When you say this is not possible, I assume you are referring to my work on app-loading in Django 1.7. Here's what comes to mind. There's a chicken'n'egg problems if an app modifies INSTALLED_APPS during app loading. This is a common idea, typically to implement a modular system or a plugin system. I don't think there's a good answer here. INSTALLED_APPS is a special case among settings. I'm not sure what to make of this limitation. Users could get into complications if an app modifies a setting after another app performed some setup based on the value of this setting. This could make app ordering more tricky. You could solve that by letting users deal with ordering problems. However, I'm wary of adding one more ramification to the ordering of INSTALLED_APPS, which already controls 4 or 5 different things. Furthermore, as I understand your proposal, settings overrides would occur as a side effect of importing a conventionally-named per-app settings module. A guiding principle in the design of app-design was to stop depending on import order because it's Very Hard to control in Python — developers do not consider that adding an import in a module should change the behaviour of their application. Finally, this would mean that pluggable apps cannot assume that settings are immutable anymore. It would become a best practice for every pluggable app to assume that any setting can change and to deal with the consequences. I'm not enthusiastic at the prospect of adding this overhead to the ecosystem. All these problems are consequences of allowing settings to be mutable during app-loading, while they're currently immutable in all circumstances. On a positive note, while this isn't officially supported, from a technical standpoint, nothing prevents you from modifying settings during app-loading. You could implement a base AppConfig class that does what you want. You "just" need to ensure that the settings you're changing are taking effect on the fly or to reset any caches based on these settings. I know there's demand for this feature; I don't know if it can be done without creating too many potential issues. I think you'll need a DEP to breaking the "settings are immutable" dogma — perhaps not a very long one if you have working code and a clear stance on the points I raised. Best regards -- Aymeric. Le mar. 7 mai 2019 à 17:02, Christian González < christian.gonza...@nerdocs.at> a écrit : > Hi, > > I know this is a bit of a question half development, half usage of django. > > I'd like to create an django app which has sub apps which inject > automatic code into settings. This is not possible, as the docs say. > > Are there plans in development to enable that? > It's not necessary to "change" settings at runtime. It's just necessary > to load "once" settings from sub apps once they are installed, which is > at server start anyway. > > There is the AppConfig.ready() method which can do things at server start. > > But my idea is: Wouldn't it be handy to have Django load settings from > apps too, e.g. with a hook like having <app>.settings.py? which are > merged into the main settings? Is this considered as security risk? > > Thanks, > > Christian > > -- > Dr. Christian González > https://nerdocs.at > > -- > You received this message because you are subscribed to the Google Groups > "Django developers (Contributions to Django itself)" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-developers+unsubscr...@googlegroups.com. > To post to this group, send email to django-developers@googlegroups.com. > Visit this group at https://groups.google.com/group/django-developers. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-developers/11e20db3-fc69-c6a9-750c-4edfb86fcc44%40nerdocs.at > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at https://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CANE-7mX4M09UX8fzgX6ia_nwXA%2BXCf0ShhkkWEVNHoadpFL_rA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.