Say I’m writing a Django app, and all the templates in the app require a certain variable.
The “classic” way to deal with this, afaik, is to write a context processor and add it to TEMPLATE_CONTEXT_PROCESSORS in the settings.py.
My question is, is this the right way to do it, considering that apps are supposed to be “independent” from the actual project using them?
In other words, when deploying that app to a new project, is there any way to avoid the project having to explicitly mess around with its settings?
Your assumption that apps can just be added in a project without touching the project’s settings is not correct.
If you add an application to a project, you have to edit the settings, since you must add it in the
INSTALLED_APPStuple.So why not edit the context processor list?