Newcomer
Before you can develop anything for Zope 3, you should, of course, install it.
Zope 3 usually requires the latest stable Python version. For the Zope X3 3.0.0 release, this is Python 2.3.4 or better. Note that you should always use the latest bug-fix release. Zope 3 does not require you to install or activate any special packages; the stock Python is fine. This has the great advantage that you can use a pre-packaged Python distribution (for example RPM, deb, Windows Installer) for your favorite operating system.
Note: While distutils is part of the standard Python distribution, packagers often treat it as a separate installation package. In order to install Zope 3, your Python must have distutils installed as well.
The only catch is that Zope 3’s C modules must be compiled with the same C compiler as Python. For example, if you install the standard Python distribution on Windows, which is compiled with Visual C++ 7, you cannot compile Zope 3’s modules with Cygwin. However, this problem is not as bad as it seems. The Zope 3 binary distributions are always compiled with the same compiler as the standard Python distribution for the operating system. Furthermore, if you want to compile everything yourself, you are likely to use only one compiler anyway.
On Unix/Linux your best bet is gcc. All Zope 3 developers are using gcc, so it will always be supported. Furthermore, all Linux Python distribution packages are compiled using gcc. In Windows, the standard Python distribution is compiled using Visual C++ 7, as mentioned previously. Therefore the Zope 3 binary Windows release is also compiled with that compiler. However, people have also successfully used gcc by using Cygwin, which comes with Python. Finally, you can run Zope 3 on MacOS X as well. All you need are gcc and the make program. With these, both Python and Zope 3 compile just fine.
Python is available at the Python Web site ( www.python.org).
In order to check out Zope 3 from SVN, you need to have a SVN client installed on your system. If you do not have a SVN account, you can use the anonymous user to check out a sandbox:
After the checkout is complete, you enter the Zope 3 directory:
From there you run make (so you need to have make installed, and it should be available for all mentioned environments). If your Python executable is not called python2.3 and/or your Python binary is not in the path, you need to edit the first line of the Makefile file to contain the correct path to the Python binary. Then you just run make, which builds/compiles Zope 3:
Next you copy sampleprincipals.zcml to principals.zcml and add a user with manager rights, as follows:
In the preceding code block, note the following:
During development, you often do not want to worry about security. In such a case you can simply give anybody the Manager role:
The fundamental application server configuration can be found in zope.conf. If zope.conf is not available, zope.conf.in is used instead. In this file you can define the types and ports of the servers you would like to activate, setup the ZODB storage type and specify logging options. The configuration file is very well documented, and making the desired changes should be easy.
Now you are ready to start Zope 3 for the first time:
The following output text should appear:
After Zope comes up, you can test the servers by typing the following URL in your browser: http://localhost:8080/. You can test FTP by using ftp://username@localhost:8021/. Even WebDAV is available using webdav://localhost:8080/ in Konqueror or your favorite WebDAV client.
An XML-RPC server is also built in to Zope by default, but most objects do not support any XML-RPC methods, so you cannot test it right away. Chapter “??” provides detailed instructions on how to use the XML-RPC server.
e following sections describe how to use the source TAR ball to compile and install a Zope 3 distribution.
The latest release of Zope 3 can be found at www.zope.org/Products/ZopeX3. First, you need to download the latest Zope 3 release by clicking the file that is available for all platforms, i.e. ZopeX3-VERSION.tgz. You can use tar or WinZip to extract the archive, like this:
For Zope 3 releases, distributation makers provided the well-known configure/ make procedure. So you can start the configuration process by using the following after you have entered the newly created directory:
If you want to place the binaries of the distribution somewhere other than /usr/local/ZopeX3-VERSION, you can specify the -prefix option as usual. Also, if you have Python installed at a non-standard location, you can specify the Python executable by using -with-python. A full configuration statement could look like this:
The following output is immediately returned:
Now that the source has been configured, you can build it by using make. After you enter the make command, the following line is returned:
The hard drive is busy for several minutes, compiling the source. When the command line returns, you can run the tests by using the following:
Here, both the unit and functional tests are executed. For each executed test, you have one dot on the screen. The check takes between 5 and 10 minutes depending on the speed and free cycles on your computer. The final output should look as follows:
The exact number of tests run depends on the version of Zope, the operating system, and the host platform. If the last line displays OK, you know that all tests passed. After you have verified the check, you can install the distribution as follows:
Note: You have to have the correct permissions to create the installation directory and copy the files into it. Thus, it might be useful to become root to execute the command.
When the installation is complete, Zope is available in the directory you specified in -prefix or under /usr/local/ZopeX3-VERSION. However, Zope will not yet run, because you have not created an instance yet. You use instances when you want to host several Zope-based sites, using the same base software configuration.
Creating a new instance is easy. You enter the Zope 3 installation directory and enter the following command:
This creates a Zope 3 instance in path/to/instance. A user who has the login username and password password is created for you, and the zope.manager role is assigned to it. All the configuration for the created instance are available in the path/to/instance/etc directory. You need to review all the information in there to ensure that it fits your needs.
You execute Zope by calling
from the instance directory. The startup output will be equal to that of the source Zope SVN installation.
You are all done now! When the server is up and running, you can test it via you favorite browser, as described earlier in this chapter.
Installing the source distribution on Windows is possible even without make. However, you need a supported C compiler to build the package. If you do not have a C compiler or Cygwin installed, you can use the Windows Installer to install Zope 3. (See the next section for more details.)
Before installing Zope 3, you need to install Python 2.3.4 or higher. On Windows NT/2000/XP the extension .py is automatically associated with the Python executable, so you do not need to specify the Python executable when running a script.
After you unpack the distribution, you enter the directory. You build the software by using this:
When the build process is complete, you can run the tests with this:
This should give you the same output as under Unix/Linux. After the tests are verified, you install the distribution by using the following command:
You have now completed the installation of Zope 3. Now you can follow the final steps in the previous section to create an instance and start up Zope.
Note: When you install Zope 3 in Windows without using make, it’s really hard to uninstall it later, because you have to manually delete files and directories from various locations, including your Python’s Lib“site-packages“ and Scripts“ directories. You also have to completely remove the zopeskel“ directory. If you use Windows Installer instead, an uninstallation program is provided and registered in the Control Panel’s Add/Remove Programs applet.
Currently binary releases of Zope are available only for Windows. These releases assume that you have the standard Windows Python release installed. The Windows binary release is an executable that automatically executes Windows Installer. The first task is to make sure that you have the correct Python version installed. Zope X3.0 is released to work with Python 2.3. Thus, you need to install the latest Python 2.3 bug fix release. You can get the Windows binary installer at www.python.org/download/.
If you already have a previous version of Zope X3, you need to remove it by using Add/Remove Programs from the Control Panel. Then you can install the Zope X3.0 release, which you can find at dev.zope.org/Zope3/Downloads. After you download it, you simply execute the installer and follow its instructions.
When the install is complete, you need to open a Windows command prompt and change to the root Python 2.3 directory, usually c:“python23“. Then you execute the instance creation script using this:
This completes the installation. You can now run Zope 3 by using this:
The instance’s bin directory also contains some other useful scripts, such as the test runner.
You can later use the Control Panel’s Add/Remove Programs applet to uninstall Zope 3 again.