Skip to main content

Company blogs as a service. Built for developers.

Project description

Butter CMS for Django

Why Butter?

Butter makes setting up a company blog on Django insanely easy. It’s built for Django developers to save us from hosting, DB setup, themeing, maintaining yet another Wordpress install. It’s designed to be quickly integrated to an existing Django project.

Butter provides a marketing friendly blogging UI, hosted on, and exposes blog content created via an API.

This package provides thin wrapper that interacts with the Butter API and a quick start blog application.


Requires Python 2.7.9 or newer. If you’re on an older version of 2.7 please take a few seconds to upgrade:

$ pip install buttercms-django
# In
# Add buttercms to INSTALLED_APPS

Grab your API token from

# In
BUTTER_CMS_TOKEN = '<your_api_token>'

Define your blog path

# In
# Add your new blog path
urlpatterns = patterns('',
    url(r'^blog/', include('buttercms-django.urls')),

Nice job. You’ve now got a blog running natively in your Django project. Nothing but Python goodness. (No PHP scripts here ;))

Check it out! http://localhost:8000/blog

Log into to start blogging!


Your new blog comes built-in with an RSS feed which lives at /blog/rss/ (assuming your blog url directory is ‘blog’).

View it at http://localhost:8000/blog/rss/

Overview of key blog views

The Butter pip package implements several views for your blog and provides a default template for each of them. The pip package also talks to an API that resides on to retrieve your blog content and exposes it in each view context.

Here’s an overview each view and the available context variables:

home: /blog

{{next_page}} # Integer used for blog post pagination (i.e. 2)
{{previous_page}} # Integer used for blog post pagination (i.e. 1)
{{recent_posts}} # Array of blog posts

post: /blog/<post-slug>

{{post}} # All content for a blog post

{{post}} has the following structure
"url": "",
"created": "05/16/2015",
"author": {
"first_name": "Butter",
"last_name": "Cms",
"slug": "butter-cms"
"categories": [
"name": "blogs",
"slug": "blogs"
"name": "butter",
"slug": "butter"
"slug": "the-state-of-company-blogs",
"title": "The State of Company Blogs",
"body": "<h3>The problem</h3><p>Countless people and essentially every...</p>",
"summary": <h3>The problem</h3><p>Countless people and essentially...</p>,
"status": "published"

author: /blog/author/<author-slug>

{{first_name}} # First name of author
{{last_name}} # Last name of author
{{recent_posts}} # Array of blog posts

category: /blog/category/<category-slug>

{{name}} # Name of the category
{{recent_posts}} # Array of blog posts

Customizing your blog

Customize the blog template

We’ve provided a default theme but we expect you’ll want skin it with your branding so we’ve made this as simple as extending your base template.

First create a blog.html template in any app templates folder that both extends your base template and your main content block.

{% extends "base.html" %}

{% block YOUR_MAIN_BLOCK %} <!-- Make sure to update this -->
{% block blog_content %}
    {% for post in recent_posts %}
    {% include "buttercms_post_list_entry.html" with post=post %}
    {% endfor %}
{% endblock %}
{% endblock %}

Make sure to replace YOUR_MAIN_BLOCK with whatever your main body block between your header and footer is. This is where the blog content will appear.

Then tell Butter about your new blog base template. In

# In
BLOG_BASE = 'blog.html'

Go to http://localhost:8000/blog and you’ll see your new professional branded blog!

Add comments to blog post template

If you want to customize the blog post template (for example to add Disqus comments at the bottom), it’s simple:

First create a blog_post.html template

<!-- note it's important this template extends the variable name 'base_template' -->
{% extends base_template %}

{% block blog_content %}
<div class="post-preview">
    <h2 class="post-title">{{ post.title }}</h2>
    <p class="post-byline">Posted by <a href="{% url 'blog_author' %}">{{ }} {{ }}</a> on {{ post.created }}
    <span class="text-muted"> in </span>
    {% for category in post.categories %}
    <span class="label label-default"><a href="{% url 'blog_category' category.slug %}">{{}}</a></span>
    {% endfor %}
    <p class="post-subtitle">{{ post.body }}</p>


<!-- Paste your Disqus embed code here --->
{% endblock %}

Tell Butter about this template. In

# In
BLOG_BASE = 'blog.html'
BLOG_POST = 'blog_post.html'

Customize other templates

You can customize other parts of the blog as well by following the same pattern. A full list of page types + settings is below:

# In
BLOG_BASE = 'blog.html'
BLOG_POST = 'blog_post.html'
BLOG_AUTHOR = 'blog_author.html'
BLOG_CATEGORY = 'blog_category.html'

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

buttercms-django-0.2.8.tar.gz (8.6 kB view hashes)

Uploaded source

Built Distribution

buttercms_django-0.2.8-py2.py3-none-any.whl (13.4 kB view hashes)

Uploaded py2 py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page