Clone wiki

gnocchi-cms / Home

Gnocchi CMS

So, you've got a simple site, and just want some pages a little smarter than Flatpages will give you?

Enter Gnocchi CMS - an entirely Admin driven CMS that gives you some simple tools, to easily do some complex sites.


Once you've gone through the setup (and installed Gnocchi Tools) add them to your INSTALLED APPS:


Don't forget to also enable Admin!



Set your TEMPLATE_CONTEXT_PROCESSORS processors to include:


If you don't have any others, a handy shortcut is:

from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS

And specify a template for DEFAULT_TEMPLATE

Optional Extras

If you want syntax hilighting in Style Sheets and Templates, download the Codemirror JS lib, and put it in your static content dir. If it's not under ${STATIC_URL}/codemirror/ add CODEMIRROR to your settings with the full prefix. Make sure you also install the gnocchi static media.


Edit templates through the web. Saves you from having to give your designers shell/ftp access.. They behave exactly as file based templates.


With a simple url pattern:

    (r'^(?P<path>.*)$', ''),

any otherwise unmatched pages will be looked for in the Page hierarchy.

If a Page does not have a Template specified, it uses what its parent would. This is recursive. If it falls all the way to a 'root' page, and it's still blank, it will use the DEFAULT_TEMPLATE setting.

Style Sheets

Why stop with Templates and Pages? Let's put Style sheets in there, too.

Adding this pattern:

    (r'^css/(?P<name>[-\w]+)\.css$', 'gnocchi.cms.views.css'),

Will publish all your style sheets as /css/{name}.css

This becomes particularly powerful when you combine the fact they're rendered as templates, with Context Variables.


If you want to use both Pages and Style Sheets, you can just use the supplied URL patterns:

    (r'', include('gnocchi.cms.urls')),

Context Variables

This provides a way for you to put values directly into the Context. They're organised in a two-level hierarchy, and the values are typed. As a fallback, there's even a JSON type to allow complex data.

When you put this together with your Style Sheets and Templates, it becomes quite a powerful theming tool.