Prerequisites
Before we can create a buildout to manage Zope and Plone, there are a few prerequisites to take care of.
First, you will need an appropriate Python interpreter, if you do not have one already:
- Install Python 2.4 for your platform, and add it to your system PATH. It is easiest if Python 2.4 is what you get when you type python -V on a command line.
- If you installed Python using an operating system package (e.g. an RPM), make sure you get the development package (e.g. python-devel) as well. This includes Python header files that we will use later to compile Zope. If you installed from source, or used the Python Windows installer, you should already have these.
- Install PIL, the Python Imaging Library into this Python interpreter.
Then, download ez_setup.py and run it with:
$ python ez_setup.py
This will download and install setuptools and the easy_install script. Watch the console output to understand where easy_install is installed. If this is not in your system PATH, you should add this directory to the path as well.
Finally, use easy_install to get ZopeSkel, a collection of skeleton templates for Zope and Plone development:
$ easy_install -U ZopeSkel
This will get Paste Script and various other dependencies. If you added the Python console scripts directory (where easy_install was placed) to your system path, you should now be able to run the paster command. You can test it with:
$ paster create --list-templates Available templates: basic_namespace: A project with a namespace package basic_package: A basic setuptools-enabled package basic_zope: A Zope project nested_namespace: A project with two nested namespaces. plone: A Plone project plone2.5_theme: A Theme for Plone 2.5 plone2_theme: A Theme for Plone 2.1 & Plone 2.5 plone3_buildout: A buildout for Plone 3 projects plone3_theme: A Theme for Plone 3.0 plone_app: A Plone App project
Your output may differ slightly, but make sure you have the plone3_buildout and plone templates at least.
Additional installation steps for Windows
If you are using Windows, there are a few more things you need to do.
First, get and install the Python Win32 extensions for Python 2.4.
If you intend to compile Zope yourself, rather than using a binary installer, or if you ever need to compile an egg with C extensions, you will need the mingw32 compiler. Make sure you choose the "base" and "make" modules at a minimum when the installer asks. By default, this installs into C:\MingW32. Inside the installation directory, there will be a bin directory, e.g. C:\MingW32\bin. Add this to your system PATH.
Finally, you need to configure Python's distutils package to use the mingw32 compiler. Create a file called distutils.cfg in the directory C:\Python24\Lib\distutils (presuming Python was installed in C:\Python24, as is the default). Edit this with Notepad, and add the following:
[build] compiler=mingw32
windows python 2.4 extensions
Cheers,
matthew lange
Good Catch!
Larry Pitcher
Permission denied
Re: permission denied
Only for global eggs
Buildout itself should never need to be run as root.
that depends on your current directory, of course
Python 2.5
What would be better - Use the Plone install programm which installs a copy of Python 2.4 too or install Plone and Zope manually and let it use Python 2.5 ?
Can't use 2.5, currently
Installing PIL
http://plone.org/documentation/how-to/basic-install-of-your-own-python-zope-plone-server-on-fedora-core-5
Installation is similar to the above for Python, consisting of un-tarring the file then running configure, make and make install:
tar-zxvf Imaging-1.1.5.tar.gz
cd Imaging-1.1.5
Look at the README file for instructions on compiling and installing but the command will look something like this:
python setup.py install
I think you can verify that PIL is installed correctly by doing this at the command line:
python
>>> import sys
>>> print sys.path
You should see something like /site-packages/PIL at the end of the path.
404 for Cheetah prereq (OS X)?
easy_install -U ZopeSkel
Searching for ZopeSkel
Reading http://pypi.python.org/simple/ZopeSkel/
Best match: ZopeSkel 1.5.1
Processing ZopeSkel-1.5.1-py2.5.egg
ZopeSkel 1.5.1 is already the active version in easy-install.pth
Using /Library/Python/2.5/site-packages/ZopeSkel-1.5.1-py2.5.egg
Processing dependencies for ZopeSkel
Searching for Cheetah
Reading http://pypi.python.org/simple/Cheetah/
Reading http://www.CheetahTemplate.org/
Reading http://sourceforge.net/project/showfiles.php?group_id=28961
Best match: Cheetah 2.0.1
Downloading http://downloads.sourceforge.net/cheetahtemplate/Cheetah-2.0.1.tar.gz?download
error: Can't download http://downloads.sourceforge.net/cheetahtemplate/Cheetah-2.0.1.tar.gz?download: 404 Not Found
working now
Clarification: about windows installers - especially for newbies
The Plone3 installer sets up all of the system software, creates and installs a zope instance (as a windows service) and creates a ready-to-use Plone Site on port 80 using an access rule. This is great if you need/want a running site ASAP, but NOT if you want to use zc.buildout as described above.
For this tutorial use the Zope installer which does (most of) the software setup for you but not the instance creations. It offers to make an instance but you will want to do that yourself with zc.buildout. The Zope installer, however, misses two critical, but simple, steps: it doesn't set the system PATH and doesn't install the python image library (PIL).
Here's the procedure:
(a) download and install Zope 2.10.x ('no' to create instance)
(b) set PYTHONPATH to the installed ...\Zope\2.10.x\Python
set SOFTWARE_HOME to the installed ...\Zope\2.10.x\Zope
set PASTERPATH to the installed ...\Zope\2.10.x\Python\Scripts
set the system PATH to include these 3 folder paths
(c) register Python with windows (so the PIL installer can find it)
create a text file with 2 lines:
[HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.4\InstallPath]
@="C:\\Zope\\2.10.5\\Python"
- where the second line specifies the same folder as PYTHONPATH above
- NOTICE the escaped (double) backslashes are needed too
save the file as temp.reg
- double-click to open/run it (answer 'yes' to add the registry entries)
- delete temp.reg (you're done with it)
(d) download the win32 installer for PIL and run it (it should find the Python you just registered)
At this point you already have easy_install (ez_setup.py is done) so you can continue from:
easy_install -U ZopeSkel
The Python win32 extensions were already installed by Zope.
You only need mingw if/when you write 'C' extensions to Python eggs, otherwise you're golden! (Eggs - get it? Golden eggs? Ok, nevermind.)
Extra steps on Windows XP
Install libxml2 python bindings using this installer:
http://users.skynet.be/sbi/libxml-python/libxml2-python-2.6.27.win32-py2.5.exe
Install mfc71.dll in C:\Windows\system32\. This is required by the Python Windows Extensions, and is found here:
http://python.net/crew/mhammond/downloads/mfc71.dll
Thanks for the great documentation!
Larry Pitcher