gargoyleA platform for dealing w/ feature toggles in Django | |
Download |
gargoyle Ranking & Summary
Advertisement
- License:
- The Apache License 2.0
- Publisher Name:
- DISQUS
- Publisher web site:
- http://disqus.com
gargoyle Tags
gargoyle Description
A platform for dealing w/ feature toggles in Django gargoyle is a platform for dealing with feature toggles in Django.Install it:pip install gargoyleEnable it:If you dont have Nexus already enabled, you will need to do that first:# settings.pyINSTALLED_APPS = ( ... 'nexus',)# urls.pyimport nexusnexus.autodiscover()urlpatterns = patterns('', ('^nexus/', include(nexus.site.urls)),)(Nexus is a replacement for your Django admin, that works with django.contrib.admin) # settings.py INSTALLED_APPS = ( ... 'gargoyle', )Use it:# as a decoratorfrom gargoyle.decorators import switch_is_active@switch_is_active('my switch name')def my_view(request): return 'foo'# within your functionsfrom gargoyle import gargoyledef my_function(request): if gargoyle.is_active('my switch name', request): return 'foo' else: return 'bar'# with custom objectsfrom gargoyle import gargoyledef my_method(user): if gargoyle.is_active('my switch name', user): return 'foo' else: return 'bar'Extend it:# myapp/gargoyle.pyfrom gargoyle import conditionsfrom django.contrib.sites.models import Siteclass SiteConditionSet(conditions.ModelConditionSet): percent = conditions.Percent() domain = conditions.String()gargoyle.register(SiteConditionSet(Site))gargoyle.is_active('my switch name', Site.objects.get_current()) Requirements: · Django · Python
gargoyle Related Software