So you've selected Python as your language of choice for building a massive web app. Congratulations! While there are some that will point to Python's relatively slow execution at runtime, you're brave enough to realize that saving chunks of your time is more important to the success of your project than building your app in a marginally faster language.

There are a few options when it comes to picking an out-of-the-box CMS with Django, but perhaps none are as popular as Django CMS. DjangoCMS is the biggest of the "big three" CMS choices for Django, with Mezzanine and Wagtail following close behind (I personally like Wagtail, if I'm gonna be real here).

As it stands, there doesn't seem to be an existing  guide which walks through the complete installation of Django + Django CMS. While is information exists in fragments, newcomers to Python could have trouble piecing much of this information together out of the gate. This guide hopes to serve as a reduction of friction to Django newcomers, thus ensuring Pythonic world domination.

Our Stack

To get this party started, our VPS is going to run the following stack:

  • Ubuntu
  • Python 3
  • Virtualenv
  • PostgreSQL
  • Django
  • Django CMS

Update All Dependencies

First, we'll prep our VPS with all the necessary dependencies:

$ apt-get update
$ apt-get upgrade -y
$ apt-get install python3 python3-pip python-dev libpq-dev postgresql postgresql-contrib

Create and Activate a Virtual Environment

Virtualenv is included with Python3, so no installation needed here.

$ virtualenv env
$ source env/bin/activate

Install Django

Find out what the latest distribution is by going here.

$ pip3 install Django==2.1.7

Install Django CMS

$ pip3 install django-cms

Start Project

Create a Django project in your desired directory.

$ cd /home
$ startproject yourproject

Update File

We'll need to update with a few things.

$ cd yourproject/yourproject
$ vim

The resulting changes to are shown in the block below. These changes include:

  • Adding the first 4 lines in INSTALLED_APPS. These apps are specific to Django CMS.
  • Adding the LANGUAGES block.
  • Update the DATABASES block with your preferred database. We'll set up the corresponding database and database user later.
  • Add SITE_ID.

    ('en-us', 'English')

    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': 'yourdb',
        'USER': 'youruser',
        'PASSWORD': 'yourpass123',
        'HOST': '',
        'PORT': '5432',


Setting up PostgreSQL

In our case, we'll be using Postgres as our database. We already installed PostgreSQL earlier; the only thing left to install is Python's psycopg2 library for connecting to PostgreSQL databases:

$ pip3 install psycopg2

Activate the psql shell as the Postgres user:

$ su - postgres
$ psql

Create the Database and Database User

Create a database with a user, matching the information you entered in earlier:

CREATE USER youruser WITH PASSWORD 'yourpass123';
ALTER ROLE youruser SET client_encoding TO 'utf8';
ALTER ROLE youruser SET default_transaction_isolation TO 'read committed';
ALTER ROLE youruser SET timezone TO 'EST';

Exit the PostgreSQL user.


Migrate the Database Changes

Start the migration.

$ python3 migrate

Create a Superuser

Create a user for the CMS.

$ python3 createsuperuser


Make sure everything is ok.

$ python3 cms check

At this point, you might notice a few errors related to sekizai. We'll need to update a few more things.

Update Again

We'll need to update with a few things.

Add 'sekizai' to INSTALLED_APPS.


Add an additional 5 lines to MIDDLEWARE:


Add 'sekizai.context_processors.sekizai', and 'django.template.context_processors.i18n', to TEMPLATES:

        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [

Finally, add your box's IP address to ALLOWED_HOSTS:



Update to look like the following:

from django.conf.urls import url, include
from django.contrib import admin

urlpatterns = [
    url(r'^', include('cms.urls')),

Give it a Go

Everything should be good! Start the app on port 8000 by entering the following:

$ python3 runserver

The app should now be accessible at your box's IP address.