Beta testing is a key phase in building a web or mobile app. When it comes to managing beta testers in Django, we recommend django-waffle.

Managing Beta Testers in Django with django-waffle

Beta testing is a key phase in building a web or mobile app. Before any definitive changes, you should have a group of beta testers that can give you feedback on how to improve your app.

If your web or mobile app is built on Django, our recommendation is to manage your beta testers with django-waffle. Here’s how you can do it.



To install the django-waffle package you must run:

pip install django-waffle

Then you have to include the package on your app’s

  • Include waffle in INSTALLED_APPS
  • Include waffle.middleware.WaffleMiddleware in MIDDLEWARE_CLASSES 

That’s it! You can now move on to creating the beta testers group.


Beta Testers Group

To create a beta testers group in django-waffle, you should first run:

./ shell

Then you can create a user group:

from django.contrib.auth.models import Group 

group = Group() 

  1. = 'Beta testers' 

Note:  change the first line if the group model you use isn’t django.contrib.auth.


Once you create your beta testers group, you can create a flag. To do so, run in the shell:

from waffle.models import Flag 

flag = Flag() = 'flag_name' = 1 

Of course, you should change ‘flag_name’ for whatever name you want to use, and set the to the from the previous step.

Everything is ready! You can now use your flags in your code.

Flags in templates

Wherever you want to show a difference in a template, you can add the waffle_tags and use the flag (which works just as an if condition):

  {% flag flag_name %}

    Flag is active!

  {% else %}

    Flag is inactive!

  {% endflag %}

You shouldn’t add too many flags at a time. Remember each flag adds a cost in time and in resources. 

Flags in views

The last step in using django-waffle is to import waffle at the beginning of the file. Then, you can alternate the behavior of your code by including:

 if waffle.flag_is_active(request, 'new_feature'):

        # Behavior if the flag is active.


        # Behavior if the flag is inactive.


And that’s all! You can now manage your beta testers in Django using django-waffle.

If you’re interested in a more advanced use of the django-waffle package, you can check the documentation.

Why We Document Our Django Projects With Django Rest Swagger

As a software developer, you understand how essential good API documentation is. Django Rest Swagger does most of the work for us!

Read more

How to Comply With EU Cookie Law in Django Projects

Using Django and need to comply with the EU law about cookies? We've got you covered, with a simple 6-step guide about it!

Read more
Cookies disclaimer

I agree Our site saves small pieces of text information (cookies) on your device in order to deliver better content and for statistical purposes. You can disable the usage of cookies by changing the settings of your browser. By browsing our website without changing the browser settings you grant us permission to store that information on your device.