You are not logged in Log in Join
You are here: Home » Members » Jens Vagelpohl » Documentation » Running Zope off CD ROM » View Document

Log in
Name

Password

 

Running Zope off CD ROM

This HowTo describes how to make a "Demo" Zope installation that can be burned onto a CD ROM and runs from the CD itself without installing anything onto the hard drive.

I tested this using the Zope 2.1.2 source distribution and the windows precompiled binaries. It is guaranteed to work with 2.1.3/2.1.4 as well. Other people have reported success on Zope 2.3.x.

If you use something like the RPMs found on some Linux distribution CDs your mileage may vary.

  • Take either an existing Zope installation tree or create a new one and create whatever demo app you wish to have in it.

  • Once you're done you should pack the database. This is not a "must" but do you want users of your demo to see a huge "undo" list when they browse the "undo" page?

  • Shut down Zope

  • In the Zope root directory create a file with the name "custom_zodb.py" and the following contents:

    import Globals, ZODB.FileStorage, ZODB.DemoStorage
    
    name='%s/Data.fs' % Globals.data_dir
    
    base=ZODB.FileStorage.FileStorage(name, read_only=1)
    Storage=ZODB.DemoStorage.DemoStorage("Demo (%s)" % name, base)
    
  • Modify the "start" script in the Zope root folder so that z2.py is called with the "-r" flag, which coincidentally means "read-only".

  • Test this setup by running the modified start script. You will see that all log messages are now going to the command line from where you ran it. This also means that while the demo runs you need to leave this window open.

  • As the last step, transfer the Zope install tree onto CD using the CD burning program of your choice. Make sure you enable long filenames by selecting Joliet extensions.

Under Windows you can use the dreaded CD autorun to have the server start automatically after the CD has been inserted. For this to work you need to create a file named "autorun.inf" in the CD root directory that contains something like...

[autorun]
OPEN=<path_to_my_start_script>

In my case it also pointed to an icon file which will show up in the Explorer window:

[autorun]
ICON=\CD.ICO
OPEN=RunDemo.BAT

Since startup off CD takes longer than off the hard drive I "embellished" my setup by calling a .bat file from autorun.inf (see above).
This batch file opened a DOS command line to start the server and popped up a web page with info:

@Echo Off
start begin.htm
Echo:
Echo:
Echo:
Echo After the server is loaded please open your preferred web browser and
Echo go to "http://localhost:8080" or double-click on the "Begin.htm"
Echo file on your CD.
Echo:
Echo:
Echo:
Echo:
Echo Please be patient, initialization may take a few minutes.....

"windows\bin\python.exe" "windows\z2.py" -r

Make sure to change paths to reflect your particular setup.

UPDATES

Maurice Davis provided some welcome feedback on improving this setup for running under Windows. He added one line to RunDemo.BAT just before the line that calls python:

set INSTANCE_HOME=.

In addition, his autorun feature did not work with this setup. He ended up using a freeware autorun.exe. This can be dropped into the CDs root directory, but make sure to edit the autorun.inf file to reflect your specific autorun's requirements.

David Lutz created a windows .ico icon file for Zope which acts as a nice replacement for the CD.ico mentioned in autorun.inf for Windows above. Download it here