How To Install Django CMS Version 3 Beta 3 With Django 1.6 on Ubuntu

Published on February 25, 2014
Default avatar

By O.S. Tezer

How To Install Django CMS Version 3 Beta 3 With Django 1.6 on Ubuntu


Since its early release over half a year ago, version 3 of Django CMS has been under constant development. The latest available developer’s package (Beta 3) comes with the promise of an API you can rely on – which is expected not to change much over the publication of RC1.

In this DigitalOcean article, we are going to see how to install and get started with this powerful content management system (CMS) that regulars cannot wait to get their hands on. Furthermore, we will try to provide some guidelines that should help with solving the great challenge of upgrading Django CMS from version 2.

Note: If you are interested in installing the currently stable version (version 2 as of March 2014) of Django CMS, check out our article: How to Set Up and Install Django CMS.


1. Django And Django CMS

  1. Django
  2. Django CMS

2. Getting Started: Preparing Your Ubuntu Droplet

3. Installing Django CMS Version 3 Beta 3

  1. Python Virtual Environment For Django CMS
  2. Django CMS And Dependencies
  3. Upgrading To Version 3 From Version 2

4. Configuring Django CMS 3

  1. Creating A New Project
  2. Configuring settings.py
  3. Configuring urls.py
  4. Configuring Templates
  5. Database And Migrations
  6. Running Django CMS

5. Getting Ready For Production

6. Summary

Django And Django CMS


Django is a Python programming language based web-development framework. Being an extremely large project and library, it packs and ships tons of tools and features to developers who are looking forward to getting started quickly.

Django CMS

Django CMS is a truly developer friendly content management system and web-development framework built on top of Django. It makes full use of Django’s advanced functionality and offers a pluggable development interface to create web-sites of all sorts.

Being a mature and business-oriented application, Django CMS knows what is valuable. Over the years, the project focused greatly on key areas to make the life easier for both developers hacking on the tool and system administrators alike.

With the release of version 3, Django CMS aims to change the game - if you will - and provide a substantially improved interface and an impressive set of features.

Getting Started: Preparing Your Ubuntu VPS

Django CMS is a Python project and you need to tune your system correctly in order to set up and run your web-site without glitches or errors.

If you haven’t got your droplet ready for this yet, head over quickly to our Ubuntu/Python article:

How To Prepare Ubuntu Cloud Servers For Python Web-Applications

And continue with the Django CMS installation (or upgrade) instructions found below.

Installing Django CMS Version 3 Beta 3

Python Virtual Environment For Django CMS

If you haven’t already, create a virtual environment:

virtualenv django_env
cd         django_env

Or activate it:

# Remember to enter the directory:
# cd [django_env]
source bin/activate

Django CMS And Dependencies

Since Django CMS version 3 has not yet been released, we need to install the application from their Git repository’s development branch.

Run the following command to Install Django CMS 3 using pip:

pip install git+git://github.com/divio/django-cms.git@develop#egg=django_cms

And install any database driver you might want to use, e.g.:

# PostgreSQL:
pip install psycopg2

One of the most relied upon dependencies is Python Imaging Library (PIL). PIL is used by Django CMS to process images (e.g. cropping, resizing, etc.)

That being said, we will abstain from directly installing PIL and opt for a more accommodating fork of PIL called “pillow”. This package is setuptools compatible and automatically solves several issues that would arise if we were to try and use pil.

Run the following to install pillow:

pip install pillow

Upgrading To Version 3 From Version 2

Run the following command to upgrade Django CMS 3 using pip:

pip install --upgrade git+git://github.com/divio/django-cms.git@develop#egg=django_cms

Note: For upgrades, please take into account that not everything is backwards compatible and things might break. Therefore, please check the Version 3 Beta blog-posts to pick up some additional, helpful upgrade tips.

Configuring Django CMS 3

Getting started with Django CMS is a straight-forward process, but it requires some setting-up. We will begin with bootstrapping the configuration and creating some example templates files that you can use to get going.

Creating A New Project

Being a Django based application, Django CMS comes with some automation, administration, and management tools as well.

In order to create a new project using django-admin, run the following:

# Usage: python django-admin.py startproject [project name]
# Example:
django-admin.py startproject dcms

# And enter the application directory:
cd dcms

Configuring settings.py

Just like Django, we need to make some changes with the settings.py - the main configuration file.

Run the following command to start editing settings.py using nano text editor:

# Usage: nano [project dir. name]/settings.py
# Example:
nano dcms/settings.py

Copy and paste (or modify) the below code-block to the top of the file to have a variable pointing to the base project directory location:

# -*- coding: utf-8 -*-
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))

Scroll down and find the column starting with INSTALLED_APPS.

Amend it to look like the following, i.e.:

    # Additional plugin examples
    # e.g.:
    # Django CMS CK Editor:
    # https://github.com/divio/djangocms-text-ckeditor
    # 'djangocms_text_ckeditor',

    # Django CMS:
    # Utilities:
    # Other CMS modules:

    # Django:


Continuing, find MIDDLEWARE_CLASSES and modify it to similar to below:


    # Django:

    # Django CMS:


Next step is adding the TEMPLATE_CONTEXT_PROCESSORS settings.

Append the below code block to the file:




Finally, go to the bottom of this file and find the line STATIC_URL. Delete it and instead append the following to suit your needs:


STATIC_ROOT = os.path.join(PROJECT_PATH, 'static')
STATIC_URL = '/static/'

MEDIA_ROOT = os.path.join(PROJECT_PATH, 'media')
MEDIA_URL = '/media/'


    # List of template directories.
    # Example:
    os.path.join(PROJECT_PATH, 'templates'),



    # List of templates.
    # Example:
    ('template_1.html', 'Template One'),



    # List of languages.
    # Example:
    ('en-us', 'English'),


Save and exit by pressing CTRL+X and confirming with Y.

Configuring urls.py

Next step is setting up some URLs, which are configured inside the urls.py file.

Run the following to start editing urls.py using nano:

# Usage: nano [project dir. name]/urls.py
# Example:
nano dcms/urls.py

Replace the content with something similar to the following example:

# Django CMS 2:
# from django.conf.urls.defaults import *
# Django CMS 3:
from django.conf.urls import patterns, include, url

from django.conf.urls.i18n import i18n_patterns
from django.contrib import admin
from django.conf import settings


urlpatterns = i18n_patterns('',
    url(r'^admin/', include(admin.site.urls)),
    url(r'^', include('cms.urls')),

if settings.DEBUG:
    urlpatterns += patterns('',
    url(r'^media/(?P<path>.*)$', 'django.views.static.serve',
        {'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),
    url(r'', include('django.contrib.staticfiles.urls')),
) + urlpatterns

Save and exit by pressing CTRL+X and confirming with Y.

Configuring Templates

Before creating a database and testing our installation (or upgrade), let’s create some templates.

Note: Make sure to define the templates inside the settings.py file first and then create them accordingly.

Run the following to create the template directories and files:

mkdir templates
touch templates/base.html
touch templates/template_1.html

Edit templates/base.html using nano:

nano templates/base.html

With the following example:

{% load cms_tags sekizai_tags %}
      {% render_block "css" %}
      {% cms_toolbar %}
      {% placeholder base_content %}
      {% block base_content %}{% endblock %}
      {% render_block "js" %}

Save and exit by pressing CTRL+X and confirming with Y.

Edit templates/template_1.html using nano:

nano templates/template_1.html

With the following example:

{% extends "base.html" %}
{% load cms_tags %}

{% block base_content %}
  {% placeholder template_1_content %}
{% endblock %}

Save and exit by pressing CTRL+X and confirming with Y.

Database And Migrations

For a new project installation, run the following commands to initiate (or set up) the database:

python manage.py syncdb --all
python manage.py migrate --fake

And perform some checks for integrity:

python manage.py cms check

# ===============

# 1 checks skipped!
# 8 checks successful!

# Installation okay

Note: For an upgrade, run migrations as needed, e.g.:

python manage.py syncdb
python manage.py migrate

# For schema migrations:
python manage.py schemamigration dcms --auto

# ! Remember to replace dcms with your project name. 

Running Django CMS

In order to see your Django CMS in action, you can use the test server.

Run the following command to run your application:

python manage.py runserver

And visit:

  • Django CMS Home:

http://[your droplet’s IP]:8000/en-us

  • Django CMS Admin:

http://[your droplet’s IP]:8000/en-us/admin

Getting Ready For Production

When you are finished creating your Django CMS project, you should try to avoid relying on the testing server the application comes with.

For deployments, a fully-fledged web-application server (e.g. Unicorn) must be used, preferably behind a reverse-proxy that will handle the initial processing of requests and distribution of static files [such as images].

To get a quick overall idea of how to go to production, check out the section titles "Getting Ready For Production"in our article: How To Prepare Ubuntu Cloud Servers For Python Web-Applications.


If you have already been through this article, or if you just want a quick summary of installation instructions to get you started:

# Preare the system and install Python tools:
aptitude    update
aptitude -y upgrade
aptitude install -y build-essential
aptitude install -y cvs subversion git-core mercurial
aptitude install python-setuptools python-dev python2.7-dev python-software-properties libpq-dev
aptitude install libtiff4-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.5-dev tk8.5-dev
curl https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py | python -
curl https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python -
export PATH="/usr/local/bin:$PATH"
pip install virtualenv

# Create a virtual environment:
virtualenv django_env
cd django_env    
source bin/activate
pip install git+git://github.com/divio/django-cms.git@develop#egg=django_cms
pip install psycopg2
pip install pillow

# Create a Django CMS project:
django-admin.py startproject dcms
cd dcms

<div class=“author”>Submitted by: <a href=“https://twitter.com/ostezer”>O.S. Tezer</a></div>

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about us

About the authors
Default avatar
O.S. Tezer


Still looking for an answer?

Ask a questionSearch for more help

Was this helpful?

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Very nice. It’s great to have the detail and the accurate links to related tutorials. Please can you do some more - ie How to customise templates or add an app.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Join the Tech Talk
Success! Thank you! Please check your email for further details.

Please complete your information!

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel