Get the compete documentation on Read The Docs
MustacheBox is a set of utilities to help you presenting graph of various data in a Django project. Data can come from whatever source you want :
- Distant API
- Couchdb databases
- Your Django models
And could be rendered using the js library of your choice : google charts, d3js, raphael etc...
A graph consist of 3 parts :
a method : the method lie in a Backend you create (or you can use predefine ones). Each method is responsible for gathering data (the way you want) and parse it to give a formated version of the data to the template.
A template: the template is a classic HTML file made to hold your graph. You can use some predefine template or use your custom one
Of course there is serval features you gain with this architecture :
url auto-discovering : you do not have to design an url for each method. MustacheBox take the pain away for you and design urls for you. Of course, if you don't like this feature, you can design your own urls for each graphs.
templatetags: when you create a graph you can use it in a templatetag too. It's really easy to do. You just have to write another template to hold your graph in the templatetag.
MustacheBox has no particular dependencies. As a django-app it need a working version of Django >= 1.3.
If you want to use the example backend and the page listing all the graphs already created you must install the docutils.
so just clone this repository :
hg clone https://firstname.lastname@example.org/boblefrag/mustachebox
Add to the installed apps
and add mustachebox to the list of your installed apps :
# settings.py INSTALLED_APPS = ( ... 'mustachebox', )
define a GRAPH_BACKEND
As MustacheBox rely on a backend, you must define your own. It's realy easy however. For a starting point, you can use the monitor_backend. This backend exist for testing and example purpose.
include MustacheBox to your urls :
To start playing with MustacheBox, you can visit :
That list all the graphs the example backend can give you.
This software is released under GPLv3