Skip to content
@dynaconf

Dynaconf

Configuration Settings for Python

Dynaconf

Dynaconf is Configuration Management for Python.

MIT License PyPIcodecov GitHub Release Date GitHub last commit Discussions

Features

  • Inspired by the 12-factor application guide
  • Settings management (default values, validation, parsing, templating)
  • Protection of sensitive information (passwords/tokens)
  • Multiple file formats toml|yaml|json|ini|py and also customizable loaders.
  • Full support for environment variables to override existing settings (dotenv support included).
  • Optional layered system for multi environments [default, development, testing, production] (also called multi profiles)
  • Built-in support for Hashicorp Vault and Redis as settings and secrets storage.
  • Built-in extensions for Django and Flask web frameworks.
  • CLI for common operations such as init, list, write, validate, export, get.
  • and many more features...

Installation

Install from pypi

pip install dynaconf

Read the docs on Dynaconf.com

Quick Start

Looking for Flask or Django plugins?

config.py

from dynaconf import Dynaconf
settings = Dynaconf(
    envvar_prefix="APP", 
    settings_files=["default_settings.toml"], 
    environments=["production", "development"]
)

default_settings.toml (yaml, ini, json, py, cfg, etc...)

[default]
name = "Default Name"
debug = true
data = {value=1}

[development]
name = "amber"

[production]
debug = false
name = "@vault /take/from/vault/secret"

main.py

from config import settings

if settings.debug:
    print(f"Hello {settings.name}")

print(settings.data.value)
print(settings.get("key", default="a default value for you"))
print(settings["NAME"], ", this also works as a dict")

console

$ python main.py
Hello amber
1
a default value for you
amber, this also works as a dict

# Environment Variables overrides
$ APP_NAME=Bruno python main.py 
Hello Bruno

# Nested env vars works
$ APP_NAME=admin APP_DATA__VALUE=42 python main.py 
Hello admin
42

Try it online

Read the docs on Dynaconf.com

Pinned Loading

  1. dynaconf dynaconf Public

    Configuration Management for Python ⚙

    Python 3.8k 293

Repositories

Showing 3 of 3 repositories
  • dynaconf Public

    Configuration Management for Python ⚙

    dynaconf/dynaconf’s past year of commit activity
    Python 3,835 MIT 293 141 (2 issues need help) 4 Updated Dec 11, 2024
  • configx Public

    [WIP] ConfigX - Settings Management

    dynaconf/configx’s past year of commit activity
    13 MIT 1 3 0 Updated Mar 6, 2024
  • .github Public
    dynaconf/.github’s past year of commit activity
    0 0 0 0 Updated Sep 5, 2022

Top languages

Loading…

Most used topics

Loading…