Moved to Mezzanine


After my server that has hosted my blog for some years had given out its last breath (second motherboard failure), I decited it was time for a change. And not just server change, but also change in the blog engine itself. As I now focus on Python and Django almost exclusively at work, it felt logical to use some kind of Django-based blog or CMS. I tried django-cms and mezzanine and ... Mezzanine is so fast and simple, that I simply stopped looking.

After simply following the tutorial and creating a skeleton project, I had a ready-to go site with all the CMS features, incuding a blog. I just had to change a few settings to have the blog module be the home page of the site, change site settings for the title and Google Analytics settings and such and tweak the theme a bit to my liking.

This was my first real exposure to a Bootstrap design. I must say - it is very simple to understand and modify if your needs fit within its limits. For example, I wanted to remove the left sidebar and expand the main content block to fill that. All I had to do was to remove the div element with class "left-sidebar span-2" and change the class of the main content part from "span-7" to "span-9". To do that I simply copied the templates/base.html file from mezzanine default templates and modified it. The information from django-debug-toolbar showed me what files were used in rendering the page.

But the feature that really got me hooked was the Wordpress import. Using a simple management command I was able to feed into Mezzanine instance the XML export file from Wordpress. It created blog posts, categories, comments, static pages and even redirects from Wordpress permalinks to Mezzanine permalinks. It was not flawless - there were a few issues:

  • I had to set the COMMENT_MAX_LENGTH setting to something higher than the default 3000 chars to accomodate some longer comments
  • As I failed to clean up the comments before exporting, comments marked as spam in Wordpress still got into the XML and showed up in the new blog without being marked as spam there
  • Some comments (mostly spam) had a much longer user name than 50 char maximum. Even with a --noinput setting that should have truncated the names, the import errored-out as Django passed the long strings to the Postgress database which promptly refused to store too much data or to truncate it. I chose to work around that by increasing the column size in Postgress.
  • One of the posts did not have a set title, so the import took the whole first paragraph as the title and then failed to create a good slug from it. This caused the redirect creation to fail. I fixed this by editing the XML file and setting a title.
  • It looks like the slug creation for the redirect and the actual slug are slightly different. Some permalink redirects for posts with non-ascii symbols in the title failed to link up correctly

After that was done it was a relatively straightforward process of picking up the code and data and deploying it to a Django-friendly hosting service. There is a plenty of good competition out there, most now offer a simple one-click Django installation, so I just created a simple Django skeleton via their web interface and then replace what they generated with my app while keeping their settings as . I should probably write a bit more details about the process. After I create a custom fabric file for this.

It is quite a strange feeling to have a Mezzanine blog that responds faster from a shared server half a continent away, compared to a Wordpress on dedicated server in the same room

There are a few features that I am still missing - most notably draft post autosave. That has bitten me hard while writing this post :P Also a Twitter digest post feature. But on the bright side - that is a great motivation to write such features, preferably in a portable way that other people can use too :)

Current rating: 4.7


aigarius 7 years, 4 months ago

Another feature for the TODO list:
* autopost of new blog entries to my Twitter stream

Link | Reply

daGrevis 7 years, 4 months ago

Looking good, working great! :)

Another thing you might want to add — favicon.

Link | Reply

Martin 7 years, 4 months ago

Too bad, that mezzanine did not make it into Debian. There was an ITP, but no upload happened. I don't like software, that is not in Debian :~(

Link | Reply

aigarius 7 years, 4 months ago

I, personally, do not see *too much* sense in having a rapidly changing web software package in Debian stable. The pattern or declaring requirements and then satisfying them in a Python virtualenv folder for each web app separately makes a bit more sense to me for these environments.
There kind of projects simply do not support running a 3 year old version.

Link | Reply

Martin 7 years, 4 months ago

Well, that's not my cup of tea. When I'm using a software for a long term deployment, I want each and every component in a central package management, security support (it's the web, right?), and uniform bug tracking. Using virtualenv + pip for playing and development would be OK, as long as the production deployment does not depend on such things, but uses proper package management. But YMMV.

Link | Reply

krs 7 years, 3 months ago

Python has its own central package management, so you still have that, you can even peg it to a version without the normal apt-conflicts.

Link | Reply

Josh Cartmell 7 years, 4 months ago

Great post and welcome to Mezzanine! Feel free to bring up any of the issues you've encountered with Mezzanine on the Google group (!forum/mezzanine-users).

The community is my favorite part of Mezzanine.

Link | Reply

Big Al 6 years, 8 months ago

I am new to django/python. I am wanting to create a business directory site, and was starting out using many tutorials, etc, but then wondered whether something like django cms or django mezzanine would be a better place to start since it would have logic like registering, logging in, etc already built into it. I don't know how difficult it would be in either of the django cms' to create a search form and then show listings one at a time, etc, and add more logic as needed. Has anyone here done something similar? Also do you then do the development on the server??? or locally and upload to the server?

Link | Reply

Kacper Kołodziej 6 years, 2 months ago

Hi! I also think about moving with my website to CMS written in Python. Now I'm using very heavy soft which I wrote about 2 years ago in PHP and Zend Framework. Despite the fact I'm using good caching mechanisms it works very slowly. I will have to optimize my soft or move to Mezzanine (or something similar).
Thanks for article! It helped me to form some new pros and cons of this Python's app.

Link | Reply

Lara 3 years, 8 months ago

Wow after 3 hours I finally found this. Thumbs up for the extremely helpful information my friend. Keep it up! I guess this is my new favorite site from now on. Just bookmarked your website!

Link | Reply

New Comment


required (not published)


Recent Posts






RSS / Atom