Satheesh Babu
2001/03/30
I develop my site using Zope. It is a very good application server. However, Zope is also a terrific content management tool. In this article, I explain how to make a static mirror of your dynamic Zope site, which can then be served by Apache/IIS or other dumb servers. This is useful, if you want to speed up things, or if your hosting provided cannot run Zope on their servers.
Please see Zope's content management guide for general idea on Zope. For most static sites, you probably have only HTML documents, images and other binary files.
Let us see what are the Zope equivalents to these.
To make a consistent looking site you can use Zope's equivalent of server
side include files called DTML Methods. This is a very
unfair analogy! DTML Methods are far more superior than silly include files!
Why? One word - Acquisition. No, this is not related to
Spanish history. In simple terms, it means that when you call or refer to
a DTML method (you refer to it as
)
Zope will see if that method is there in the current folder. If there, it
will use that. If not, it will go to the parent folder of the current folder
and then check there. And so on. So, Acquisition will get you the nearest one
available. This is so cool, because for the whole site spanning multiple folders,
you can have just one set of include files at the root folder! Compare this with
normal include files, which will have to be replicated everywhere and probably
have to be referenced using absolute URLs.
Important note! This explanation of Zope and DTML methods is a very unfair and simplistic one. DTML methods and DTML (Zope's template language) are very powerful programming tools. For more information, check the documentation section at Zope.org.
My previous article about using Zope for these kind of things covered some ground. However, the scripts shown here are far better and actually mirror a Zope site!
On a side note, every one can scream WGET at me! However, I didn't find it that good for my purposes.
I called it 0_folderfile_listing because I usually name all DTML methods as
0_blah_blah. This shows them up at the top. You must create this DTML method
at the top most level in Zope's hierarchy.
View the code
The code is also there at the end of the script given below. You can copy the
last 3 lines and paste it into the DTML method. Remove the ## at the beginning
of each line. You should not format it to beautify it!
You can run this script with the same
Python that comes with Zope. See the bin
folder under your Zope
installation. That has a Python interpreter. Essentially, this is a rewrite
of the ftpmirror.py script that is included in the standard Python distribution.
You can edit the script and search for tux. That is the name of my
Zope server. Change it with your server name.
Well, after you have saved the script as say zopemir.py, you can run it as
python zopemir.py -v -r http://myzopesite /
It will mirror your entire Zope site to the current folder. For explanation
on options, see the code.
Since you are seeing this, it means that your browser does not support cascading style sheets. Please download and use one of the many browsers that support web standards.