This article assumes that you are familiar with installing and configuring Django. Mezzanine is a Django project at http://mezzanine.jupo.org/. It is licensed under BSD. It can be used, modified, and redistributed commercially. There is a demo available at http://mezzanine.jupo.org/en/admin/login.

Installation

Installation is pretty easy if you are familiar with Python and Django. We use virtualenv and virtualenvwrapper for all python project. We recommend both for all project development. If you already know, you may skip the installation of virtualenv and virtualenv wrapper. 

Install virualenv and virtualenvwrapper:

# Install virtual environment
$ pip install virtualenv

# Install virtual environment wrapper
$ pip install --user virtualenvwrapper

Setup startup file on shell:

Add these three lines to your shell startup file (.bashrc, .profile, etc.) to set the location where the virtual environments should live, the location of your development project directories, and the location of the script installed with this package:

# Where you wish to install the virtual environments
export WORKON_HOME=$HOME/.virtualenvs

# Your ptoject directory
export PROJECT_HOME=$HOME/Devel

# Activate virtual wrapper
source /usr/local/bin/virtualenvwrapper.sh

Create a new project:

First, create a project with virtualenvwrapper

[email protected]:~/$ mkproject atemon-website-blog

Running virtualenv with interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /home/vc/.envs/atemon-website-blog/bin/python3
Also creating executable in /home/vc/.envs/atemon-website-blog/bin/python
Installing setuptools, pip, wheel...done.
virtualenvwrapper.user_scripts creating /home/vc/.envs/atemon-website-blog/bin/predeactivate
virtualenvwrapper.user_scripts creating /home/vc/.envs/atemon-website-blog/bin/postdeactivate
virtualenvwrapper.user_scripts creating /home/vc/.envs/atemon-website-blog/bin/preactivate
virtualenvwrapper.user_scripts creating /home/vc/.envs/atemon-website-blog/bin/postactivate
virtualenvwrapper.user_scripts creating /home/vc/.envs/atemon-website-blog/bin/get_env_details
bash: cd: /home/vc/development/atemon-website-blog: No such file or directory
Creating /home/vc/development/atemon-website-blog
Setting project for atemon-website-blog to /home/vc/development/atemon-website-blog
(atemon-website-blog) [email protected]:~/development/atemon-website-blog $ 

This will create and setup a virtual environment, activate the virtual environment and change the current working directory to the new directory atemon-website-blog under your PROJECT_HOME

Install Mezzanine:

Install mezzanine with pip so that the django package will be installed automatically

# Install from PyPI
$ pip install mezzanine

# Create a mezzanine-django project
$ mezzanine-project atemon
$ cd myproject

Initilize database

The mezzanine-project command creates following directoy & files

atemon
├── atemon     # The django app
│   ├── __init__.py
│   ├── local_settings.py
│   ├── settings.py
│   ├── urls.py
│   └── wsgi.py
├── deploy     # templates used by fabfile.py
│   ├── crontab.template
│   ├── gunicorn.conf.py.template
│   ├── local_settings.py.template
│   ├── nginx.conf.template
│   └── supervisor.conf.template
├── fabfile.py     # python fabric commands to setup and deploy a server. At this stage we dont use this
├── __init__.py
├── manage.py   # a *modified* django command wrapper
└── requirements.txt

At this stage, we get the basic, fully-functional blog. It uses SQLite by default (Django developers knows why) Now we can go and initialize db and run the project.

# Create a database
$ python manage.py createdb --noinput

# Run the web server
$ python manage.py runserver

Done ! ! !

You can go to http://127.0.0.1:8000/  to see your new blog ready.

Now you can add a new superuser using manage.py, the Django way and start blogging.

Customising Mezzanine will be covered in next post.