I've always wondered what is the best way to have per app settings.py files. In a way such as the configuration related to the app can be either on the app settings.py file or in the project settings.py file.
I'm asking this right now because I'm planning to release an app I've developed, and I want it to be reusable. So in the app/settings.py file I'd put the default configuration values.
More precisely, I have an emails app, which is that I want it to be reusable. The structure is as follows:
- emails
- settings.py
- tasks.py
- ...
- my_project
- settings.py
In the emails/settings.py file I have the default values for the config params:
USE_EMAIL_DIGEST = True
EMAIL_DIGEST_PERIOD = 24*3600
Then, in my_project/settings.py I override some of those params:
EMAIL_DIGEST_PERIOD = 12*3600
What is the best option to access EMAIL_DIGEST_PERIOD param from emails/tasks.py file? Currently I'm doing:
from django.conf import settings
import emails.settings as esettings
getattr(settings, "EMAIL_DIGEST_PERIOD", esettings.EMAIL_DIGEST_PERIOD)
But I think is is very verbose