Use this example application to integrate with CloudBees platform and test feature management. After integrating, observe changes in the application UI as you update flag values in CloudBees platform.
In this example, the Rox SDK is already set up, and feature flags are implemented in the code.
Get started with the Django project
To get started with the django-fm-example project, follow these steps:
-
Using Git, clone the django-fm-example repository to your local machine:
git clone git@github.com:cloudbees-io/django-fm-example.git -
In your IDE (for example, PyCharm, VS Code, or another Python IDE), select File and open the cloned repository as a Django project. You will revisit this project in your IDE later to run the application.
-
Locate and copy the SDK key:
-
Navigate to .
-
Select an application.
-
Select
next to the SDK key on the page.If no SDK key is available:
-
Navigate to .
-
Select Installation instructions in the upper-right corner.
-
Follow the installation instructions to complete the installation. The SDK key appears once an application is linked to an environment.
-
Close the installation instructions and copy the SDK key.
-
-
-
Add the SDK key to the application:
-
Open the
demo/fm_init.pyfile:demo/fm_init.py -
Locate the following placeholder in the file, and replace it with your SDK key:
sdk_key = "<Your CloudBees SDK key>"
-
-
Run the application locally:
python3 -m venv venv source venv/bin/activate pip install -r requirements.txt python manage.py migrate python manage.py runserver 8000 -
To view the application running, go to
http://localhost:8000/demo/in your web browser.
View the imported flags
Now that your application is running, you can view and interact with the imported feature flags in the CloudBees platform UI.
-
In CloudBees platform, select Feature management.
-
Select your example application to display the available flags as shown in the table below.
Table 1. Feature flags in the example application Flag name Flag type Description showMessageBoolean
Turns the message on or off.
messageString
Sets the message text.
fontSizeNumber
Sets the message font size in pixels. The flag value has the following variations:
12,16, or24.fontColorString
Sets the message font color. The flag value has the following variations:
red,green, orblue.If no flags are displayed, verify that the environment-specific SDK key is correctly added in your example application, save the file, and restart the application.
Apply changes to flags in the UI
Now that you can view the available flags, you can update their values directly in the CloudBees platform UI and see the changes reflected in your running application.
-
Select Feature management.
-
Select the application.
-
Select
next to the flag you want to configure. -
Select Configure.
-
Select the Environment.
-
Update a flag value and save your changes.
-
Set Configuration status to On.
-
The updated flag value is reflected in the application display shortly.
Use the application with multiple SDK keys
Run multiple instances of the SDK in a single application, each with its own SDK key and environment. Each instance is fully isolated. Use this configuration when you need to read or compare flags across environments without redeploying, support multi-tenant routing, or combine server-side and client-side evaluations in one application.
To use multiple SDK keys in an example application:
-
Retrieve the SDK keys for the environments you’ll use.
-
Initialize a separate SDK instance for each key.
-
Decide how to route requests to instances (for example, by tenant, region, or environment selector).
-
Perform register/fetch/stream setup on each instance as required by your SDK.
-
Evaluate flags using the selected instance. Pass a consistent user/context object for accurate targeting.
-
Tag logs or metrics by instance, and shut down instances you no longer need.
Documentation reference
For more information about using multiple SDK keys, refer to Manage multiple SDK keys in your application.
For installation details, refer to Install the SDK.