A Waffle Flag is a Django Waffle control for releasing a new feature to selected visitors instead of every user at once. Put the new behavior behind a conditional check, configure who qualifies, and let beta users encounter it while everyone else keeps the familiar path. This limits the blast radius of a bad assumption without hiding the code in a separate branch forever. section 13.4 section 13.6
Django Waffle offers three levels of control. A Switch is globally on or off; a Sample enables a feature for a percentage of visitors; a Flag is the detailed option, deciding visibility from configured visitor attributes such as role, account, language, group, and other criteria. Use a Flag when “some users” needs a clearer definition than “a random slice.” section 13.4 section 13.6
Set up Django Waffle before relying on any of its controls:
- Install the django-waffle package with pip. section 13.4
- Add waffle to INSTALLED_APPS and waffle.middleware.WaffleMiddleware to MIDDLEWARE so requests can be evaluated against Waffle configuration. section 13.4
- Run migrate, because Waffle stores its configured state in database tables. section 13.4
Beta access for a new RiffMates feature
Suppose a new musician-profile workflow is ready for feedback but not ready for every visitor. Guard that workflow with a Waffle Flag and configure the flag for the intended beta audience, such as a group or account category. Qualifying visitors see the new path; others continue using the existing one. Tests still matter: flags reduce release risk, but they cannot correct a misunderstood requirement. section 13.4 section 13.6
