Migrating Plone Sites to Django

Published: 2008-11-01 20:50 UTC. Tags: software plone django noplone

As mentioned earlier on this blog, I have converted this site from Plone to Django.

The conversion included migrating most of the data from the Plone instance's ZODB (Zope Object Database) into Django's ORM.

The hard part of that process is to get the data out of ZODB as the format depends completely on which Plone products you have been using. You need to check the schema for each product for which you want to extract data to get the field names, and you need to write code for extracting the data from each type of content type and add a new object in Django's ORM, translating data from one format to another in some cases.

In my case, I wrote a script that takes care of:

  • Document and Folder objects from Plone's standard contenttypes.
  • Blog entries in a Quills blog.

The script will traverse all Document, Folder and Blog entries and extract their data, adding instances of Django models from two custom Django products I have written.

A second script will then read the data from Django's database and modify the URLs in <img> tags, downloading the images from the Plone site via HTTP to a directory which will be configured as MEDIA_ROOT in Django. The script does the same for <a> tags that refer to images, .tar.gz files, etc. that also were stored in the ZODB of the Plone instance.

Each site that wants to do a conversion from Plone to Django will have to write their own script, as the set of products used in the Plone instance is site-specific, and the set of applications used in Django is also site-specific. However, I have made my conversion scripts available via subversion in the hope that they can serve as an example.

To access the scripts, either check them out with your subversion client. Example:

git clone git://github.com/forsberg/misctools.git

The scripts are in the plone2django_migration subdirectory.

You can also browse them here:

https://github.com/forsberg/misctools/tree/master/plone2django_migration

←← previous blog entry next blog entry →→

Comment by thearchitect

Created Wed, 26 Nov 2008 17:42:22 +0000

Have you fully abandoned plone? If so, what pushed you over the edge?

Looking to migrate my site to plone 3, started playing with it.Now i am looking for a reason to stay, even with my memory issues, and the ridiculous new learning curve. (Although after seeing pinaxproject for django, i feel i have wasted so much time trying to create a social layer for plone...)

Comment by Sam

Created Wed, 25 Feb 2009 17:09:16 +0000

I have a big site that I built about 5 years back completely in zope2.x

I was just thinking the other day of migrating the whole mess over to django the other day and thinking about what kind of scripts would/could serve to help automate some of it.

Looks like you already did some initial leg work! Thanks!

The question would then be: "how much extra work did you need to do after running the scripts?"

In your case, it looks like the blog would be fairly straightforward to port, but maybe I'm missing something. I've got several forms, AJAX'y stuff here and there and search capabilities.

Don't know whether I want to retain the original design anyway since it could probably use some re-factoring...

Let me know how much work this all was for you.

Post a comment

Posting of comments have been disabled for now. Too much spam.