Manage Content with Markdown and Mango on Debian 5 (Lenny)

Updated by Linode

Contribute on GitHub

View Project | View File | Edit File

This guide has been deprecated and is no longer being maintained.

Mango is a simple static content management system for publishing blogs from content stored in plain text files. Built as a dynamic web application using components from the Django framework, Mango is simple to deploy and administer and uses the Markdown lightweight markup language to process text. This guide describes the process for configuring a Mango-based site using the Apache HTTP Server and mod_wsgi to handle the dynamic aspects of the website.

Set the Hostname

Before you begin installing and configuring the components described in this guide, please make sure you’ve followed our instructions for setting your hostname. Issue the following commands to make sure it is set properly:

hostname -f

The first command should show your short hostname, and the second should show your fully qualified domain name (FQDN).

Prepare System

Issue the following commands to update your system’s package database, ensure that all installed applications are up to date, and install all dependencies required for running Mango:

apt-get update
apt-get upgrade
apt-get install apache2 python-setuptools libapache2-mod-wsgi build-essential mercurial python-dev libxml2-dev libxslt-dev zlib1g-dev
easy_install pip

This guide describes the process for installing the Mango CMS on the root level of the, with the DocumentRoot of /srv/www/ Throughout this guide, replace these paths and domains in examples with the actual paths of your site.

Install Mango

Issue the following command to create the required directories for the Mango VirtualHost:

mkdir -p /srv/www/
mkdir -p /srv/www/

Issue the following commands to install Django, create a Django project in the application directory, download the Mango application, install required Python modules, and prepare files and file permissions for Mango:

cd /srv/www/
pip install Django startproject application
cd /srv/www/
hg clone
pip install -r /srv/www/
mkdir /srv/www/
touch /srv/www/
chown www-data:www-data /srv/www/

Edit the INSTALLED_APPS list at the end of the /srv/www/ file to resemble the following:


Edit the ROOT_URLCONF variable in the /srv/www/ file to resemble the following:

ROOT_URLCONF = 'mango.urls'

Edit the urlpatterns array in the /srv/www/ file to resemble the following:

urlpatterns = patterns('',
    (r'', include('mango.urls')),

Create a application.wsgi file, using the following as a model:

 1 2 3 4 5 6 7 8 91011121314151617
import os
import sys

path = '/srv/www/'
if path not in sys.path:
    sys.path.append(path + '/application')
    sys.path.append(path + '/application/mango')


os.environ['PYTHON_EGG_CACHE'] = '/srv/www/'

os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

Configure Apache

Create a VirtualHost specification based on the following example:

 1 2 3 4 5 6 7 8 91011121314
<VirtualHost *:80>

   DocumentRoot /srv/www/

   ErrorLog /srv/www/
   CustomLog /srv/www/ combined

   WSGIScriptAlias / /srv/www/

   Alias /static /srv/www/

Issue the following command to enable the “VirtualHost and restart the web server to load the configuration:

/etc/init.d/apache2 restart

You will need to restart the server anytime you make changes to the Apache configuration or application.wsgi files.

Configure the Mango Site

The behavior of the Mango application is controlled the settings in the /srv/www/ file which you can override in a /srv/www/ file. Add configuration values to as needed to produce your site. The most relevant settings are below:

DOCUMENTS_PATH = 'content'

SITE_TITLE = 'example Blog'

The paths specified in this file are relative to the top level of the Django application, for this document: /srv/www/ In the above example, all documents processed by Mango are stored in the /srv/www/ directory. Explore each setting in this document while you configure your site.

Write Content with Mango

All content with Mango exists in source as Markdown, a lightweight markup language that mirrors formatting conventions for plain text emails. Markdown is designed to be easy to read and write, and can be translated efficiently into high quality HTML. Consider the following example entry:


date: 02 February 2011 time: 08:06am tags: blog, meta, example

First Post

Welcome to Mango. If this page appears in full HTML glory (with bold and _emphasized_ text) then everything’s probably working correctly. Congratulations!

## More Details

Learn more about mango and [Markdown][]!


The first three lines of this file define header values that are processed by the Markdown implementation and used to control how Mango displays and organizes the posts. The format of the date and time fields is very strict, adhere to the format above. You may now visit your site at To add new posts to your site, simply save files using the above format in the content/ directory.

More Information

You may wish to consult the following resources for additional information on this topic. While these are provided in the hope that they will be useful, please note that we cannot vouch for the accuracy or timeliness of externally hosted materials.

See Also

comments powered by Disqus

This guide is published under a CC BY-ND 4.0 license.