Python Dynaconf Settings — ELI5
Think about how your phone has different modes. At school you put it on silent. At home you turn the volume back up. You don’t get a new phone for each place — you just change the mode.
Dynaconf does the same thing for a Python program’s settings. Your app might need to talk to a test database while you’re building it, and a real database when real people use it. Instead of editing files every time you switch, Dynaconf lets you define multiple “modes” (it calls them environments) and switch between them with a single setting.
What makes Dynaconf special is that it can read settings from many places at once: a settings file, environment variables on the computer, a secrets vault, or even a Redis server. It layers them together, with later sources winning over earlier ones. So you can have default settings in a file but override just the password using a secure vault — without changing any code.
It also updates settings while your program is running. If someone changes a value in the settings file, Dynaconf can notice and use the new value without restarting. That’s like your phone changing volume on its own when it detects you walked into school.
The one thing to remember: Dynaconf manages settings from many sources and many environments, so your code stays the same everywhere.
See Also
- Python Black Formatter Understand Black Formatter through a practical analogy so your Python decisions become faster and clearer.
- Python Bumpversion Release Change your software's version number in every file at once with a single command — no more find-and-replace mistakes.
- Python Changelog Automation Let your git commits write the changelog so you never forget what changed in a release.
- Python Ci Cd Python Understand CI CD Python through a practical analogy so your Python decisions become faster and clearer.
- Python Cicd Pipelines Use Python CI/CD pipelines to remove setup chaos so Python projects stay predictable for every teammate.