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.12; Django 6.x requires Python 3.12+) Django (4.2, 5.2 LTS, 6.0) Django REST Framework (3.15+)
Installation
Install using pip:
pip install django-frontend-settings
Add ‘frontend-settings’ to your INSTALLED_APPS setting.
INSTALLED_APPS = [
...
'frontend_settings',
]
Expose the view in your urls:
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:
$ 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:
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
}
Metadata
Release files for django-frontend-settings 2.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django_frontend_settings-2.3.0.tar.gz | 11.2 kB | Details |
Release files / django_frontend_settings-2.3.0.tar.gz
| Download URL | django_frontend_settings-2.3.0.tar.gz |
|---|---|
| Size | 11.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8f1e862a59f04e26f73b9e06a2807d4d7b41f07bde44757b2bb5e21c400a4188
|
|
BLAKE2b-256 checksum How to use checksums |
ba3858e2f506a88954ca4e10c8c1b84e41aff96b0afdbe0d78c2cbed099bdd16
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|