Skip to content

Commit 2b39c6c

Browse files
committed
Write README on how to use
1 parent f06aab4 commit 2b39c6c

File tree

1 file changed

+57
-1
lines changed

1 file changed

+57
-1
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+
}

0 commit comments

Comments
 (0)