jazzband / django-waffle

A feature flipper for Django
https://waffle.readthedocs.io
BSD 3-Clause "New" or "Revised" License
1.12k stars 258 forks source link

Waffle switch in Django template fails with JSON serializable error #490

Closed cjproud closed 11 months ago

cjproud commented 11 months ago

I currently have a feature that is accessed by a button in the Django admin interface, like so:

{% switch "some_feature_switch" %}
    Some feature button in HTML page
{% endswitch %}

I get an error when trying to use this in our staging environment (but not dev), I assume because our staging environment uses Redis for caching and I get an error along the lines of:

TypeError: Object switch is not JSON serializable

Are there any workarounds people know of for this?

cjproud commented 11 months ago

Note, a quick workaround if you're using django-redis is to rollback to the default serializer which uses pickle rather than the JSONSerializer.