Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
The code that powers djangosnippets.org, it allows users to post and share useful "snippets" of code.
Python JavaScript HTML CSS Ruby
Tree: 3799ac25ba

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
cab
deploy
.gitignore
LICENSE
README.rst
setup.py

README.rst

Cab

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

Installation notes

Cab has a couple of external dependencies:

Additionally, the default setup requires a few applications which are bundled with Django itself:

  • django.contrib.comments to enable commenting.

  • django.contrib.markup to handle Markdown formatting of

    comments.

  • django.contrib.syndication to enable feeds.

It's also recommended that you have django.contrib.admin installed 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

Then add ratings, taggit and cab to the INSTALLED_APPS setting 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 Language, Snippet and Tag models assume that they will live under the URLs /languages/, /snippets/ and /tags/, so if you want them to go elsewhere you'll need to edit those methods or ovveride them with Django's ABSOLUTE_URL_OVERRIDES setting.

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 following lines:

import haystack haystack.autodiscover()

Templates

The git repo will get you a set of example templates matching those currently in use on djangosnippets.org

OMGWTF Tests?

Yeah, there are tests now.

Something went wrong with that request. Please try again.