Cab (named for the jazz bandleader and scat singer Cab Calloway) is a Django application which allows users to post and share useful "snippets" of code.
This code is used to power the snippet sharing site, djangosnippets.org
Cab has a couple of external dependencies:
- Pygments for code highlighting.
- python-markdown for processing snippet descriptions. Other Python ports of Markdown will not work, since the code which calls Markdown assumes the existence of python-markdown's "safe mode".
- django-simple-ratings for item ranking
- django-taggit for tagging
- django-haystack for search
- django-amazon-resources for recommended titles
Additionally, the default setup requires a few applications which are bundled with Django itself:
django.contrib.commentsto enable commenting.
django.contrib.markupto handle Markdown formatting of
django.contrib.syndicationto enable feeds.
It's also recommended that you have
for ease of site maintenance.
Once you've got those taken care of, grab a git checkout of Cab from somewhere on your Python path:
git clone git://github.com/coleifer/djangosnippets.org.git
cab to the
of your Django project, run
manage.py syncdb, and either put a call to
include('cab.urls.snippets') somewhere inn your root URLConf or copy over
the URL patterns from Cab that you want to use.
Note that the
get_absolute_url methods of the
Tag models assume that they will live under the
/tags/, so if you want
them to go elsewhere you'll need to edit those methods or ovveride
them with Django's
For search support you need to set up a search engine and configure haystack:
HAYSTACK_SITECONF = 'search_sites'
HAYSTACK_SEARCH_ENGINE = 'whoosh'
# Place where search indexes are stored for snippets - should be non web accessible
HAYSTACK_WHOOSH_PATH = '/some-path/search-index'
And you should add a file called
search_sites.py to your project with the
The git repo will get you a set of example templates matching those currently in use on djangosnippets.org
Yeah, there are tests now.