Metadata-Version: 2.4
Name: django_frontend_settings
Version: 2.1.0
Summary: Expose feature flags and settings from django waffle and django constance in an endpoint.
Home-page: https://github.com/loadsmart/django-frontend-settings
Author: Loadsmart
Author-email: developer@loadsmart.com
License: MIT
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Framework :: Django :: 4.1
Classifier: Framework :: Django :: 4.2
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.10
License-File: LICENSE.txt
Requires-Dist: django<5,>=4.1
Requires-Dist: djangorestframework<4,>=3.13
Requires-Dist: django-picklefield
Requires-Dist: django-constance<3,>=2
Requires-Dist: django-waffle<3,>=2
Provides-Extra: test
Requires-Dist: django-constance[database]; extra == "test"
Requires-Dist: factory_boy; extra == "test"
Requires-Dist: pytest; extra == "test"
Requires-Dist: pytest-cov; extra == "test"
Requires-Dist: pytest-django; extra == "test"
Provides-Extra: lint
Requires-Dist: black; extra == "lint"
Requires-Dist: flake8; extra == "lint"
Requires-Dist: isort; extra == "lint"
Provides-Extra: doc
Provides-Extra: dev
Requires-Dist: tox; extra == "dev"
Requires-Dist: setuptools-scm; extra == "dev"
Requires-Dist: django-constance[database]; extra == "dev"
Requires-Dist: factory_boy; extra == "dev"
Requires-Dist: pytest; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"
Requires-Dist: pytest-django; extra == "dev"
Requires-Dist: black; extra == "dev"
Requires-Dist: flake8; extra == "dev"
Requires-Dist: isort; extra == "dev"
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: home-page
Dynamic: license
Dynamic: license-file
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

Frontend Settings
=================

Abstract
--------

This project provides an API that expose settings and feature flags for the frontend.

It uses `django-drf` to create an endpoint to expose flags and settings configured in `django-waffle` and `django-constance`



Usage
-----

Requirements
Python (3.10, 3.11, 3.12)
Django (4.1, 4.2)
Django REST Framework (3.13+)

Installation
~~~~~~~~~~~~
Install using pip:

.. code::

    pip install django-frontend-settings

Add 'frontend-settings' to your INSTALLED_APPS setting.

.. code:: python

    INSTALLED_APPS = [
        ...
        'frontend_settings',
    ]

Expose the view in your urls:

.. code:: python

    from django.urls import path
    from frontend_settings.views import settings as frontend_settings_view

    path("frontend-settings/", frontend_settings_view, name="frontend-settings"),


Then your flags from waffle and setting from constance should be returned on a get in this route:


.. code::

    $ curl 'http://localhost:8000/frontend-settings/'
    {"data":{"flags":{"MY_FEATURE_FLAG":true},"settings":{}}}


In that case I had `FRONTEND_MY_FEATURE_FLAG` flag in waffle.
The default prefix for flags is `FRONTEND_`, if you like to change it you can do by changing the following config on settings.py:

.. code:: python

    FRONTEND_SETTINGS = {
        "WAFFLE_FLAG_PREFIX": "FRONTEND_", # Prefix used to filter out the flag that should be exposed in the endpoint
        "CONSTANCE_KEY_PREFIX": "FRONTEND_", # Prefix used to filter out the settings in constance
    }
