How Wedding Together added a blog to their Django app in 5 minutes
Tags: django, blogplatform
Published: 2017-07-13 13:30:08

---
title: How Wedding Together added a blog to their Django app in 5 minutes
published: true
description: Adding a blog to a website is a problem as old as the internet. If we find ourselves reinventing the wheel, we’re probably doing it wrong
tags: django, blog platform
---

_For more content like this, follow [ButterCMS on Twitter](https://twitter.com/ButterCMS) and subscribe to our [blog](https://buttercms.com/blog/)._

## Our Problem

We’re python developers and we want to add a blog to [Wedding Together](https://weddingtogether.co). Wedding Together is a mobile app that allows wedding guests to share photos they take at weddings. Adding a blog to a website is a problem as old as the internet. If we find ourselves reinventing the wheel, we’re probably doing it wrong. I could discuss building our own blogging system from scratch, but there are already plenty of articles on how to do that.

## Our Requirements

*   We don’t want to worry about SEO. It shouldÂ come built-in.
*   We want to put whatever code we pull from GitHub to live at weddingtogether.co/blog without any NGINX/Apache witchcraft.
*   We don’t want to be editing HTML files or writing code every time a content change is made.

One requirement makes a clear separation between all the paths we can take. **We want to protect and improve our development processes.**

If we don’t want:

*   a separate set of SASS stylesheets just for this blog.
*   to spend time managing security updates.
*   to mess with our current configuration.
*   to role our own solution.

Our option is to pick a managed solution. We’ll go over those second. If we’re ok with someÂ of those things, then we have two self-managed options.

## Our Options

### Self Managed

The two most popular python web frameworks are [Django](https://www.djangoproject.com/) and [Flask](http://flask.pocoo.org/). Wedding Together’s backend is built with Django, so we’ll start there. A few Google searches later we find [Mezzanine](http://mezzanine.jupo.org/) to be the most active Django blog project. If the best option involves the downside of creating an additional application to take care of, we might as well look up options in Flask. The two most used options are [flask-blog](https://github.com/dmaslov/flask-blog) and [Flask-Blogging](https://github.com/gouthambs/Flask-Blogging). flask-blog hasn’t been updated in 3 years. Flask-Blogging is our “Mezzanine level” blog option but in Flask. Both Mezzanine and Flask-Blogging have the following pros and cons:

*   Pros:
    *   Has all the bells and whistles out of the box. We don’t want to deal with things like SEO and meta what-not.
    *   Hackable if we want to make modifications
    *   Simple non-developer interface for making blog posts
    *   “Free” (explained below)
*   Cons
    *   **Requires us to manage and maintain another application**

Depending on how your infrastructure is setup, adding another application could be as simple as pip installing on a server or as difficult as adding another machine to your already growing architecture.

Most web/software companies have one resource that they’ll never get enough of, developer time. Mezzanine and Flask-Blogging are “free” if you don’t consider developer time. If you account for developer time in implementing these options, they are among the most expensive options you could pick.

### Managed For Us

Let’s look at a managed option that is almost free in a sense of developer time. [ButterCMS](../) is a managed blog option with the most developer friendly API possible. I've tried out half a dozen blog API options and ButterCMS is truly the easiest and most simple.

We log into the interface on their site to write a blog post.

![](https://cdn.buttercms.com/S7L9ewu7TR6Cpx31uJmQ)

We install the python module.

    pip install buttercms-python

We pull our blog post:
```
    from butter_cms import ButterCMS

    def blog(request):
        client = ButterCMS('your-token-goes-here')
        posts = client.posts.all()
        return render(request, 'blog.html', {'posts': posts})
```

Put it in our template:

```
    {% for post in posts %}
        <h1>{{ post.title }}</h1>

        <p>{{ post.body|safe }}</p>
    {% endfor %}
```

And that's it!

![](https://cdn.buttercms.com/U7oBxCIR1uW8sv1htFrV)

My example is missing couple tiny tweaks to make Django play perfectly their API, all of which are covered [here](../docs/api-client/django#Blogging) in their docs.

## Our Choice

Spinning up an instance of Mezzanine or Flask-Blogging is a definite possibility, but took me more hours than I'd like to admit to get going. I'm also not exactly looking forward to dealing with another database and django application as time goes on.

Adding a managed option like ButterCMS took me about 5 minutes and I know I'll never have to mess with it again.

Most of the other blogging APIs are filled with cryptic terms like "blog modelling" or having to navigate a "content delivery API" vs a "content management API". ButterCMS touts a simple and straight forward system that lets you focus on building your company and products.

_This was originally posted [here](https://buttercms.com/blog/options-for-adding-a-blog-to-python-application)._