Skip to main content

Stay informed of it

Project description

Django Dynamic Settings

Build status PyPI PyPI - Django version PyPI - Python version PyPI - License

Django Dynamic Settings allows you to create & use dynamic settings backed by a database.


Installation using pip:

pip install dj-dynamic-settings

dj_dynamic_settings app has to be added to INSTALLED_APPS and migrate command has to be run.

    # other apps here...

dj_dynamic_settings.urls must be included to a desired url path.

urlpatterns = [
    url(r"^api/v1/", include("dj_dynamic_settings.urls")),

Setting class must be defined & registered. Please make sure that this class' module runs whenever the application runs.

from dj_dynamic_settings.registry import BaseSetting, registry
from dj_dynamic_settings.validators import TypeValidator

class FeatureActive(BaseSetting):
    key = "FEATURE_ACTIVE"
    validators = [TypeValidator(bool)]
    default = False
    description = "Flag for Feature X"

Create Setting instance using view.

import requests
        "Authorization": "Token <secret-login-token>",
        "key": "FEATURE_ACTIVE",
        "value": True,
        "is_active": True,

Access this setting as in django.conf.settings

from dj_dynamic_settings.conf import settings

settings.FEATURE_ACTIVE  # True

Testing Tools


You can override a setting for a test method or test class.

from dj_dynamic_settings.utils import override_settings
from django.test import TestCase

class FeatureTestCase(TestCase):

    def test_feature(self):
        # Some stuff

    def test_feature_x(self):
        with override_settings(SOME_OTHER_SETTING="SOME_OTHER_SETTING"):
            # Some stuff

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for dj-dynamic-settings, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size dj_dynamic_settings-0.1.1-py3-none-any.whl (10.6 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size dj-dynamic-settings-0.1.1.tar.gz (12.6 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page