Make your life easier with INSTANCE_HOME
Created by .
Last modified on 2003/09/12.
A default Zope installation places your site data
within the same subdirectory as the Zope software
itself, and encourages you to add Products to the
same directory as the ones which came with Zope.
It doesn't have to be this way, though. You can
easily place all of your site's data, and the
Products it uses, in a separate location.
Why would I want to do that?
- you can keep "standard" Zope Products separate
from ones you have installed. You can make some
Products and Extensions shared, and some site-
specific.
- you can run multiple, independent Zope sites
from the same installation of Zope.
- you can keep multiple versions of Zope around,
and easily change the version used by a site.
- you can upgrade Zope by just installing the
new version.
How does it work?
Zope looks for an environment variable called
INSTANCE_HOME. If it is found, its value is
the location of var , import , and access .
It can also have a custom_zodb.py module.
Both the INSTANCE_HOME location and the Zope
installation can have Products and
Extensions . The INSTANCE_HOME is searched
first.
So what do I do?
- Create a directory for your site
- Place the
var and Extensions directories
and the access file for the site in the site
directory. If you are starting from
scratch, you can make empty directories
and create access with the zpasswd.py
utility.
- Create an
import directory and a
Products directory. Install or copy products
you use that are not distributed with Zope into
this Products .
- (*nix only) If you want to share some Products
among all sites, but still keep them independent
of your Zope installation, you can create a
Shared_Products directory for them somewhere,
then symlink them into the Zope Products directory.
- If you follow Jim Cain's excellent
howto, you can skip the following steps.
- Copy
start and stop to the site
directory.
- (*nix only) Edit
start to look something like the
following (the lines defining and exporting
variables are the important ones):
#! /bin/sh
reldir=`dirname $0`
INSTANCE_HOME=`cd $reldir; pwd`
export INSTANCE_HOME
exec /usr/bin/python2.1 \
/usr/local/Zope2.4.3/z2.py \
-D "$@"
- (Win32 only) Edit
start.bat using Notepad
or your favorite text editor to look
something like the following (using your own
file paths, of course):
"C:\Zope\bin\python.exe" "C:\Zope\z2.py" -D %1 %2 %3 %4 %5 %6 %7 %8 %9 INSTANCE_HOME="C:\MyWebSite"
- Edit
stop so that the path it uses leads
to the site's var , not the Zope installation.
What now?
Use the start and stop scripts in the site
directory to control that site. You can install
a new version of Zope simply by replacing your
current installation. You can install different
versions of Zope in different directories, and
switch among them by changing the path to Zope
in your start script.
|