Django and CMS projects
This post was updated on 2010-07-05
Django and CMS projects
Some time ago I wrote about Django powered CMS projects. In particular I described django-cms and also mentioned Fein CMS. Both projects are really good ones (compare them) but... their competitor has just arrived (ok, almost because it is still in alpha) - Lighting Fast CMS.
LFC comes from the author of Lighting Fast Shop and shares some elements with that project so if you used LFS you will be positively surprised.
A bite of django-lfc
My first impression was: "oh.. it's plonish!". Yup, LFC resembles Plone to me - I really like this kind of clean interface and available options. It's not Django's Admin any more (see django-cms and feincms) but LFC's own management panel.
LFC is intuitive. I was able to set up a simple site without reading any docs. Of course there are docs! It is important thing in any serious project and LFC is going to be serious.
Full list of LFC features is rather long, so if you are interested just follow the link. I especially like: content types, portlets,
authorisation based on mapping between roles and permissions
There is no rose without a thorn
Sadly, LFC is not yet 1.0 final, so nobody can expect it to be bug free and in fact there is some bugs. For example it is quite easy to set up running instance of LFC using buildout, but it quickly turns out that it is limited to work on supplied sqlite database only. There are still some problems that make it hard to run LFC on other database engines like postgres. However, everything is possible so if you're interested in how to set up current (1.0 alpha 8 - "Man o' War") release of LFC to work with postgres please read on.
LFC and Postgres
You can read about LFC installation in the official docs. The important part is to call:
hg clone http://bitbucket.org/diefenbach/lfc-buildout-development
However, in my case, before I performed the next step in installation process I had to modify buildout.cfg. Here is mine:
[buildout] parts = PIL django lfc lfc_theme lfc_blog tagging contact-form django-fcgi permissions portlets workflows [lfc] recipe = mercurialrecipe repository = http://bitbucket.org/diefenbach/django-lfc/ [lfc_theme] recipe = mercurialrecipe repository = http://bitbucket.org/diefenbach/lfc-theme [lfc_blog] recipe = mercurialrecipe repository = http://bitbucket.org/diefenbach/lfc-blog [permissions] recipe = mercurialrecipe repository = http://bitbucket.org/diefenbach/django-permissions [portlets] recipe = mercurialrecipe repository = http://bitbucket.org/diefenbach/django-portlets [workflows] recipe = mercurialrecipe repository = http://bitbucket.org/diefenbach/django-workflows [tagging] recipe = mercurialrecipe repository = http://bitbucket.org/fivethreeo/django-tagging-inheritance/ [PIL] recipe = zc.recipe.egg:custom egg = PIL==1.1.6 find-links = http://dist.repoze.org/ [contact-form] recipe = gocept.download url = http://bitbucket.org/ubernostrum/django-contact-form/get/1d3791fa4dfb.zip md5sum = 8e3e257fda807fef5f3abcc6b5beb398 [django-fcgi] recipe = collective.recipe.template port = 8000 input = ${buildout:directory}/misc/conf/django-fcgi.sh.in output = ${buildout:directory}/bin/django-fcgi.sh [django] recipe = djangorecipe version = http://code.djangoproject.com/svn/django/branches/releases/1.1.X eggs = PIL==1.1.6 psycopg2 feedparser pysqlite django-pagination django-extensions project = lfc_project settings=settings extra-paths = ${buildout:directory}/lfc_project ${buildout:directory}/parts/permissions ${buildout:directory}/parts/workflows ${tagging:location} ${contact-form:location} ${lfc:location} ${lfc_theme:location} ${lfc_blog:location} ${permissions:location} ${workflows:location} ${portlets:location} urls = lfc_project/urls
My modifications included:
- setting a specific version of PIL (PIL == 1.1.6) - otherwise there was an import error
- setting a specific version of Django - to include some patches for bugs that were causing LFC to raise exceptions when used with postgres
After everything was installed I changed settings.py to configure postgres database there.
My next step was to comment out last line: post_syncdb.connect(register) in parts/lfc/models.py. This line makes register function to be called on syncdb signal, but there is a problem because register is called multiple times. This breaks something when register function is trying to add the same objects for the second time (there is an unique index) raising database transaction errors.
After commenting the line out I ran syncdb and successfully created database tables and my superuser. Then I uncommented the line and called syncdb again. This raised an error but in general it worked registering important things like portlets, templates and content types.
Updated content: The last thing to do is to load some data. There is a helpful script initialize_lfc.py in scripts directory, so it is enough to start Django's shell (bin/django shell) and run:
from scripts import initialize_lfc initialize_lfc.run()
The last thing I had to do was to add a Portal instance. To accomplish this I disabled lfc.context_processors.main context processor and added django.contrib.admin to INSTALLED_APPS in settings.py. I also added (r'^admin/(.*)', admin.site.root), to urls.py. Then I was able to enter admin panel and add Portal object there. After adding Portal I enabled (uncommented) lfc.context_processors.main and was able to work with LFC management panel.
After doing the above I was able to add things through admin panel. For example I got an exception when I tried to enter "Roles" menu. I had to add a role in admin to overcome this.
Another thing I did was to call bin/django loaddata to load predefined fixtures from LFS apps (you can find it in parts directory). I'm not sure why but these fixutres are not loaded automatically.
Summary
LFC has some cool features, not so bad docs and good hmm... feeling. I just like it, it's nice, pretty, it has good clean website containing even screencasts (to be honest I don't like screencasts so I didn't watch them :D). I'm going to use LFC in my project soon. It's not yet 1.0 but it already has some live sites. I'm sure it will be a serious competitor to django-cms and feincms, so don't bother to give it a try.







2010-05-08 at 19:43 from http://topsy.com/trackback?utm_source=pingback&utm_campaign=L2&url=http://restlessbeing.pl/blog/2010/05/07/django-lfc/