Skip to content

Commit c1d8f19

Browse files
authored
Merge pull request #4 from loadsmart/add-readme
Write README on how to use
2 parents 875479b + b106b04 commit c1d8f19

File tree

2 files changed

+58
-2
lines changed

2 files changed

+58
-2
lines changed

README.rst

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,60 @@ Frontend Settings
44
Abstract
55
--------
66

7-
Dynamic settings and feature flags for the frontend.
7+
This project provides an API that expose settings and feature flags for the frontend.
8+
9+
It uses `django-drf` to create an endpoint to expose flags and settings configured in `django-waffle` and `django-constance`
10+
11+
12+
13+
Usage
14+
-----
15+
16+
Requirements
17+
Python (3.6, 3.7, 3.8, 3.9)
18+
Django (2.2, 3.0, 3.1, 3.2)
19+
20+
Installation
21+
~~~~~~~~~~~~
22+
Install using pip:
23+
24+
.. code::
25+
26+
pip install django-frontend-settings
27+
28+
Add 'frontend-settings' to your INSTALLED_APPS setting.
29+
30+
.. code:: python
31+
32+
INSTALLED_APPS = [
33+
...
34+
'frontend-settings',
35+
]
36+
37+
Expose the view in your urls:
38+
39+
.. code:: python
40+
41+
from frontend_settings.views import settings as frontend_settings_view
42+
43+
url(r"^frontend-settings/", frontend_settings_view, name="frontend-settings"),
44+
45+
46+
Then your flags from waffle and setting from constance should be returned on a get in this route:
47+
48+
49+
.. code::
50+
51+
$ curl 'http://localhost:8000/frontend-settings/'
52+
{"data":{"flags":{"MY_FEATURE_FLAG":true},"settings":{}}}
53+
54+
55+
In that case I had `FRONTEND_MY_FEATURE_FLAG` flag in waffle.
56+
The default prefix for flags is `FRONTEND_`, if you like to change it you can do by changing the following config on settings.py:
57+
58+
.. code:: python
59+
60+
FRONTEND_SETTINGS = {
61+
"WAFFLE_FLAG_PREFIX": "FRONTEND_", # Prefix used to filter out the flag that should be exposed in the endpoint
62+
"CONSTANCE_KEY": "FRONTEND_SETTINGS", # Name of the settings in constance
63+
}

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
setup_requires=["setuptools_scm"],
3535
url='https://github.com/loadsmart/django-frontend-settings',
3636
license='MIT',
37-
description='Dynamic settings & feature flags for the fronted.',
37+
description='Expose feature flags and settings from django waffle and django constance in an endpoint.',
3838
long_description=open('README.rst', 'r', encoding='utf-8').read(),
3939
author='Loadsmart',
4040
author_email='[email protected]',

0 commit comments

Comments
 (0)