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
}
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file django_frontend_settings-2.3.0.tar.gz.
File metadata
- Download URL: django_frontend_settings-2.3.0.tar.gz
- Upload date:
- Size: 11.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8f1e862a59f04e26f73b9e06a2807d4d7b41f07bde44757b2bb5e21c400a4188
|
|
| MD5 |
478cf738e9ef437302aa04a313f3f5fd
|
|
| BLAKE2b-256 |
ba3858e2f506a88954ca4e10c8c1b84e41aff96b0afdbe0d78c2cbed099bdd16
|