Skip to main content

A django app to help you manage the django-shopify-app package billing

Project description

This app helps to add feature flags to your django app

Installation

pip install django-feature-flags

Usage

Add feature_flags to your INSTALLED_APPS in settings.py

INSTALLED_APPS = [
    ...
    'feature_flags',
    ...
]

Add your feature flags and feature flag groups in your settings.py

FEATURE_FLAGS = {
    'feature1': {
        'description': 'This is a feature flag',
    },
    'feature2': {
        'description': 'This is a feature flag',
    },
    'feature3': {
        'description': 'This is a feature flag',
    },
}

FEATURE_FLAG_GROUPS = {
    'group1': ['feature1', 'feature2'],
    'group2': ['feature3'],
}
FEATURE_FLAG_DEFAULT_GROUP = 'group1'

Add the feature flag group to your tenant model

from feature_flags.utils import get_feature_flags_by_group_name

class Tenant(models.Model):
    ...
    feature_flags_group = models.CharField(
        max_length=255,
        choices=FEATURE_FLAG_GROUPS.items(),
        default=FEATURE_FLAG_DEFAULT_GROUP,
    )
    ...

    @property
    def feature_flags(self):
        return get_feature_flags_by_group_name(self.feature_flags_group)

Project details


Download files

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

Source Distribution

django_feature_flags-0.0.3.tar.gz (2.9 kB view hashes)

Uploaded Source

Built Distribution

django_feature_flags-0.0.3-py3-none-any.whl (5.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page