News for hackers. Stuff that matters.
Re:A guide to organizing settings in Django by Alir3z4 on Friday November 12, 2021 @10:07AM (#29199937)
Don't do this.

Keep everything in settings.py and use environment variables (django-environ) to configure it.

In a project with tens and tens of apps and so many modules requiring configurations and easily reaching more than thousand settings key, keeping 1 settings.py has not failed me.

With the approach mentioned in the article, you'll get to a point where you'll be having so different setting module for each env.

01. local

02. testing

03. CI/CI

04. E2E

05. Docker

06. Kubernetes

07. staging

08. release

09. production

10. k8s_win.py

11. k8s_linux.py

12. k8s_mac.py

13. heroku.py

14. pie.py

15. home.py

16. vacation.py

17. ...

Soon you'll get to a place where you need to kind of merge 2 of them (settings/docker.py and settings/kubernetes.py) or worse, several of them and then hell is unleashed. You get confused, your team gets confused, the new team member is confused, no one has any idea where to look at.

Just keep it in 1 place, let your brain stay healthier and prevent early cancer.

Re:A guide to organizing settings in Django by mattupstate on Friday November 12, 2021 @11:12AM (#29200819)
I'd go so far as to say that configuration details for specific runtime environments should never be the concern of the application/service/program itself. It's almost always a smell to me when I see "dev" "prod" "stage" "local" in code unless it's an abstraction over the configuration for some sort of logical runtime profile.
Re:A guide to organizing settings in Django by senko on Friday November 12, 2021 @11:11AM (#29200810)
OP here. I agree with you. Quoting from the article:

> We can now go back to only having settings.py that imports dotenv, fetches the configuration, and initializes Django settings as needed.

Re:A guide to organizing settings in Django by scwoodal on Friday November 12, 2021 @04:16PM (#29204623)
Can you share an example of what a single settings file looks like that configures the 1 through 17 environments you have listed?
Re:A guide to organizing settings in Django by marcosdumay on Friday November 12, 2021 @10:15AM (#29200015)
Well, now you have the exactly equivalent problem of managing your environment variables.

What is better depends on your tooling.