Installation

Dependencies

Make sure to install these packages prior to installation :

The packages below are optionnal but needed for run the full test suite or migrate the database.

Note that all the needed dependencies will be resolved if you install Zinnia with pip or easy_install, excepting Django.

Getting the code

For the latest stable version of Zinnia use easy_install:

$ easy_install django-blog-zinnia

or use pip:

$ pip install django-blog-zinnia

You could also retrieve the last sources from https://github.com/Fantomas42/django-blog-zinnia. Clone the repository using git and run the installation script:

$ git clone git://github.com/Fantomas42/django-blog-zinnia.git
$ cd django-blog-zinnia
$ python setup.py install

or more easily via pip:

$ pip install -e git://github.com/Fantomas42/django-blog-zinnia.git#egg=django-blog-zinnia

Applications

Assuming that you have an already existing Django project, register zinnia, and these following applications in the INSTALLED_APPS section of your project’s settings.

INSTALLED_APPS = (
  'django.contrib.auth',
  'django.contrib.admin',
  'django.contrib.sites',
  'django.contrib.sessions',
  'django.contrib.messages',
  'django.contrib.staticfiles',
  'django.contrib.contenttypes',
  'django_comments',
  'mptt',
  'tagging',
  'zinnia',
)

Template Context Processors

Add these following template context processors if not already present.

TEMPLATES = [
  {
    'BACKEND': 'django.template.backends.django.DjangoTemplates',
    'APP_DIRS': True,
    'OPTIONS': {
      'context_processors': [
        'django.contrib.auth.context_processors.auth',
        'django.template.context_processors.i18n',
        'django.template.context_processors.request',
        'django.contrib.messages.context_processors.messages',
        'zinnia.context_processors.version',  # Optional
      ]
    }
  }
]

URLs

Add at least these following lines to your project’s urls.py in order to display the Weblog.

from django.conf.urls import include
from django.conf.urls import url

url(r'^weblog/', include('zinnia.urls')),
url(r'^comments/', include('django_comments.urls')),

Remember to enable the admin site in the urls.py of your project if you haven’t done it yet for having the edition capabilities.

Note that the default Zinnia URLset zinnia.urls is calibrated for convenient usage, but you can customize your Weblog URLs as you want. Here’s a custom implementation of the URLs provided by Zinnia:

blog_urls = ([
    url(r'^', include('zinnia.urls.capabilities')),
    url(r'^search/', include('zinnia.urls.search')),
    url(r'^sitemap/', include('zinnia.urls.sitemap')),
    url(r'^trackback/', include('zinnia.urls.trackback')),
    url(r'^blog/tags/', include('zinnia.urls.tags')),
    url(r'^blog/feeds/', include('zinnia.urls.feeds')),
    url(r'^blog/random/', include('zinnia.urls.random')),
    url(r'^blog/authors/', include('zinnia.urls.authors')),
    url(r'^blog/categories/', include('zinnia.urls.categories')),
    url(r'^blog/comments/', include('zinnia.urls.comments')),
    url(r'^blog/', include('zinnia.urls.entries')),
    url(r'^blog/', include('zinnia.urls.archives')),
    url(r'^blog/', include('zinnia.urls.shortlink')),
    url(r'^blog/', include('zinnia.urls.quick_entry'))
], 'zinnia')

url(r'^', include(blog_urls))

Sites

Define the value of SITE_ID if not already done.

SITE_ID = 1

Emails

Be sure that the sending of emails is correctly configured, otherwise the moderation system will not work. Please refer to https://docs.djangoproject.com/en/dev/topics/email/ for more information about sending emails.

Static Files

Since the version 1.3 of Django, Zinnia uses the staticfiles application to serve the static files needed. Please refer to https://docs.djangoproject.com/en/dev/howto/static-files/ for more information about serving static files.

Syncing the database

Now that you have everything set up, simply run the following in your project directory to sync the models with the database.

$ python manage.py migrate