Ella as a blog system (aka back to blogging)

For dogfooding reasons, I decided I'll make my personal site using CMS we're using at work – Ella.

And it may be my blog as well.

Although Ella is open-source, it's not really treated as first-class citizen. Situation is improving, but until then, I'll share practical steps for creating a site like this one.

Basic installation and configuration

First, explore tutorial on github. It will explain basic concepts and walk you through creating basic, blog-like site.

As there are no public releases yet, I'd recommend to fork the repository (as I did) and setup private branch. You'll have upgrade control and if You discover some bugs, porting them back to upstream will be trivial.

So, You have followed tutorial and have skeleton Ella project inside virtualenv with all required dependencies. As we're eager to tag ourselves and do some other cool stuff in future, we'll use following ella apps in settings.py:

INSTALLED_APPS = +(
    'ella.core',
    'ella.articles',
    'ella.photos',
    'ella.galleries',
    'ella.polls',
    'ella.ratings',
    'ella.newman',
    'ella.newman.licenses',
    'ella.positions',
    'ella.sendmail',
    'ella.attachments',
    'ella.series',
    'ella.ellatagging',
    
    'djangomarkup',
    'tagging',
 
    'almadnejsemin.service',
)

Tagging must be also enabled in urls.py:

urlpatterns += patterns('',
    (r'^tags/', include('ella.ellatagging.urls')),
    ('^', include('ella.core.urls')),
)

Also, as You'd probably like to see static file during development, edit settings/local.py and enable them:

ENABLE_DEBUG_URLS = True

And I'm fancy and I'd like to use markup language suited for my keyboard (or maybe because adding syntax-highlighter <pre> was so easy), so I'll enable it in settings:

DEFAULT_MARKUP = 'czechtile'

And we're set! Only thing to add now is HTML stuff, which is less boring than it should be, but covered elsewhere. Just a note: after You'll add those base templates and add a basic design, don't forget that articles are special and You'd like to display text and tags for them.

So open up templates/page/content_type/articles.article inherit from Your base template and fill it in.

As You can see, tags are clickable and leads to a list. This is also a simple, separate template.

Deployment

So it works on Your machine, but how about the rest of the world? Well, deploying Ella is no different from deploying any other Django application. In my case – virtualenv, supervise, flup, fastcgi and lighttpd saves the day.

Create your virtual environment on the server in the same way as on Your host. Fill setting/local.py with your production values (or maybe You're root and will use /etc) and get ready by firing up ./manage.py syncdb.

Lighty is will communicate with our fcgi socket, which is easy to set up. Just don't forget we have some media that should not be served by django.

$HTTP["host"] == "almad.nejsem.in" {
    fastcgi.server = (
      "/django.fcgi" =>
        ( "main" => (
            "socket" => "/path/to/dir/site.socket",
            "check-local" => "disable"
        ))
    )

        alias.url += (
            "/media" =>  "/path/to/project/media"
        )

        url.rewrite-once = (
                "^(/media.*)$" => "$1",
                "^/favicon\.ico$" => "/media/favicon.ico",
                "^(/.*)$" => "/django.fcgi$1"
        )
}

daemontools may be DJB's weirdware, but it's so useful in life out there that I cannot stop using it. You should try it too. After installation, mkdir /service/sitename and create file named run:

#!/bin/sh
exec 2>&1
export WEBAPP=/path/tp/projct/dir
export VENVBIN=/path/to/project/virtualenv/bin

## UID and GID to spawn to
USERID=your-user
GROUPID=special-group-shared-with-lighty-or-lighttpd
FCGISOCKET=/path/to/dir/site.socket

touch $FCGISOCKET
chmod 0770 $FCGISOCKET
chown $USERID:$GROUPID $FCGISOCKET

exec setuidgid $USERID $VENVBIN/python $WEBAPP/manage.py runfcgi daemonize=false socket=$FCGISOCKET umask=0770

chmod +x /service/site/run and behold – Your shiny Ella site!

First blogsteps

Go to Ella's custom-build admin, located at /newman/. Log in with your admin account and look around.

First, however, ensure site is set correctly: sites –> sites and fill in the right domain.

After that, create some basic categories (core –> categories): mines are „almad.nejsem.in“ (without parent category, on site „almad.nejsem.in“) and Blog (with parent category „almad.nejsem.in“, still on same site).

Now, You should be able to publish some thoughts. Go to articles –> add, fill in interesting title. Add yourself as author, choose „Blog“ category and create some interesting perex and text. Hit „main category“ under Placement, choose „now“ in under „Start of visibility“ and create some tags.

When You'll hit „Save“, You should see the post in Your „blog“ category.

Wrapping up

While Ella's documentation is still a bit scarce, it's ready for prime time. Although still more suitable for magazines then personal blog, it's fairly fast for setting up and offer some compelling features (we're gonna talk later about).

And still 100% Django, so easy to combine with other reusable apps.

Watch the repository and follow Twitter – documentation updates and public releases will be posted there.

Code for this blog is available, so feel free to fork it.

Published on March 1, 2010 under django ella english