{"id":1822,"library":"dynaconf","title":"Dynaconf","description":"Dynaconf is a dynamic configuration management library for Python projects, inspired by the 12-factor application guide. It supports multiple file formats (TOML, YAML, JSON, INI, Python), environment variables, Hashicorp Vault, and Redis for settings and secrets. It provides a flexible, layered system for multi-environment configurations and includes built-in extensions for Flask and Django. The library is actively maintained, with the current version being 3.2.13, and receives regular updates and bug fixes.","status":"active","version":"3.2.13","language":"python","source_language":"en","source_url":"https://github.com/dynaconf/dynaconf","tags":["configuration","settings","dynamic","environment variables","toml","yaml","json","ini","secrets","multi-environment","cli"],"install":[{"cmd":"pip install dynaconf","lang":"bash","label":"Basic Installation"},{"cmd":"pip install dynaconf[toml,yaml,redis,vault]","lang":"bash","label":"Installation with Optional Dependencies"}],"dependencies":[{"reason":"For Redis backend support.","package":"redis","optional":true},{"reason":"For Hashicorp Vault backend support (installed via [vault] extra).","package":"hvac","optional":true},{"reason":"For YAML file support (installed via [yaml] extra).","package":"ruamel.yaml","optional":true},{"reason":"For TOML file support (installed via [toml] extra).","package":"toml","optional":true},{"reason":"For INI file support (installed via [ini] extra).","package":"configobj","optional":true}],"imports":[{"note":"The global `settings` instance is deprecated in Dynaconf 3.x. Users are encouraged to create their own `Dynaconf` instance instead.","wrong":"from dynaconf import settings","symbol":"Dynaconf","correct":"from dynaconf import Dynaconf"}],"quickstart":{"code":"from dynaconf import Dynaconf\n\n# Create settings files (e.g., settings.toml and .secrets.toml)\n# settings.toml:\n# [default]\n# FOO = 'bar'\n# DATABASE_URL = 'sqlite:///mydb.sqlite'\n#\n# .secrets.toml:\n# [default]\n# API_KEY = 'secret-key-123'\n\nsettings = Dynaconf(\n    envvar_prefix=\"DYNACONF\",\n    settings_files=['settings.toml', '.secrets.toml'],\n    environments=True, # Enable layered environments\n    load_dotenv=True # Explicitly enable .env file loading (disabled by default in 3.x)\n)\n\n# Access settings\nprint(f\"Foo: {settings.FOO}\")\nprint(f\"Database URL: {settings.DATABASE_URL}\")\n\n# Access secret\n# For production, consider using environment variables or a secure vault.\n# Example: export DYNACONF_API_KEY=\"my_prod_api_key\"\napi_key = settings.get('API_KEY', os.environ.get('DYNACONF_API_KEY', 'default-api-key'))\nprint(f\"API Key: {api_key}\")\n\n# Switch environment (e.g., in a development environment)\n# export ENV_FOR_DYNACONF=development\n\n# Example of setting a value programmatically (not persisted to file)\nsettings.set('NEW_SETTING', 'a new value')\nprint(f\"New setting: {settings.NEW_SETTING}\")","lang":"python","description":"This quickstart demonstrates how to initialize Dynaconf, load settings from specified TOML files (including a secrets file), and access configuration values. It highlights the importance of explicitly enabling `load_dotenv` and `environments` in version 3.x and shows how to access values, including sensitive ones, with a fallback to environment variables for production readiness."},"warnings":[{"fix":"Replace `from dynaconf import settings` with `from dynaconf import Dynaconf; settings = Dynaconf(...)`. Make sure to pass your `settings_files` explicitly.","message":"The global `settings` object (`from dynaconf import settings`) is deprecated in version 3.x. You should now explicitly instantiate `Dynaconf()` to manage your settings.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"When initializing `Dynaconf`, provide a list of your configuration files: `settings = Dynaconf(settings_files=['settings.toml', '.secrets.toml'])`.","message":"Automatic loading of settings files (e.g., `settings.toml`, `.secrets.yaml`) is disabled by default in Dynaconf 3.x. Files must now be explicitly passed via the `settings_files` argument during `Dynaconf` instantiation.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"To enable `.env` file loading, set `load_dotenv=True` during `Dynaconf` instantiation: `settings = Dynaconf(..., load_dotenv=True)`.","message":"Loading of `.env` files is disabled by default in Dynaconf 3.x.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Ensure your IDE's run/test configuration sets the working directory to the root of your project. Alternatively, explicitly specify `root_path` when initializing `Dynaconf`.","message":"Dynaconf's path resolution relies on the Current Working Directory (CWD). Running tests or applications from an IDE that changes the CWD (e.g., PyCharm setting CWD to `./tests`) can cause `OSError: Starting path not found` as Dynaconf may fail to locate settings files.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Do not install or use `dynaconf==3.2.8` or `dynaconf==3.2.9`. Upgrade to `3.2.10` or later.","message":"Versions 3.2.8 and 3.2.9 were yanked from PyPI, indicating potential issues or regressions. Users should avoid these specific versions.","severity":"breaking","affected_versions":"3.2.8, 3.2.9"},{"fix":"Upgrade to `dynaconf==3.2.13` or a later version to patch these vulnerabilities.","message":"Templating vulnerabilities (`@jinja` and `@format`) were fixed in version 3.2.13. Older versions using these features might be susceptible to security risks. [cite: latest release notes]","severity":"breaking","affected_versions":"<3.2.13"}],"env_vars":null,"search_vec":"'12':15 '3.2.13':70 'activ':63 'applic':17 'bug':76 'built':53 'built-in':52 'cli':91 'configur':6,49,78 'current':67 'django':59 'dynaconf':1,2 'dynam':5,80 'environ':29,48,81,90 'extens':55 'factor':16 'file':22 'fix':77 'flask':57 'flexibl':42 'format':23 'guid':18 'hashicorp':31 'includ':51 'ini':27,86 'inspir':12 'json':26,85 'layer':43 'librari':8,61 'maintain':64 'manag':7 'multi':47,89 'multi-environ':46,88 'multipl':21 'project':11 'provid':40 'python':10,28 'receiv':72 'redi':34 'regular':73 'secret':38,87 'set':36,79 'support':20 'system':44 'toml':24,83 'updat':74 'variabl':30,82 'vault':32 'version':68 'yaml':25,84","created_at":"2026-04-09T05:06:45.253237+00:00","updated_at":"2026-04-16T14:44:35.308698+00:00","problems":[{"fix":"pip install dynaconf","cause":"The 'dynaconf' library has not been installed in the current Python environment.","error":"ModuleNotFoundError: No module named 'dynaconf'"},{"fix":"Ensure Dynaconf is initialized with the correct `settings_files` and `root_path`. If using layered environments, set `environments=True` in `Dynaconf()` and verify the `ENV_FOR_DYNACONF` environment variable or `env` argument. For nested keys, use dot notation (e.g., `settings.SECTION.MY_KEY`).","cause":"Dynaconf cannot find the requested setting 'MY_KEY'. This can be due to incorrect file loading paths, a missing environment variable, or accessing a key in a non-active environment or scope.","error":"AttributeError: 'Settings' object has no attribute 'MY_KEY'"},{"fix":"Explicitly define the `root_path` in your `Dynaconf` instance using an absolute path (e.g., `Dynaconf(root_path=os.path.dirname(os.path.abspath(__file__)))`), or configure your IDE's run/debug settings to set the working directory to your project's root.","cause":"Dynaconf's path resolution for settings files often relies on the Current Working Directory (CWD), which can be altered by IDEs or specific test runners, preventing it from finding your configuration files.","error":"OSError: Starting path not found"},{"fix":"Review the setting's value to ensure it complies with the associated validator's conditions, or adjust the validator definition if its requirements are not correct for the intended configuration.","cause":"A validation rule defined using Dynaconf's `Validator` feature has failed, indicating that a setting's value does not meet the specified criteria (e.g., `must_exist`, `is_type`, equality conditions, or custom functions).","error":"ValidationError"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"3.3.5","cli_name":"dynaconf","cli_version":"3.2.13","type":"library","homepage":"https://www.dynaconf.com","github":"https://github.com/dynaconf/dynaconf","docs":null,"changelog":null,"pypi":"https://pypi.org/project/dynaconf/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops","serialization","web-framework","database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-27","next_check":"2026-07-28","install_tag":null}}