UbuntuHelp:LearningZope3
来自Ubuntu中文
点击翻译: |
English |
请不要直接编辑翻译本页,本页将定期与来源同步。 |
Motivation
Creating zope3 applications is no easy task. This document comes out of a desire to help build a zope3 user community in support of SchoolTool and the CanDo competency tracking application which is being built on top of SchoolTool. The goal here is to keep things as simple as possible. Zope3 is extremely complex, and the learning curve is steep to say the least. I'm assuming that the aspiring zope3 developer here will be using Ubuntu Dapper (or Edgy), and running their zope instance from their home directly on the port specified in their zope.conf file.
Installation
For the following commands, you will need sudo privileges:
- make sure you have the following packages installed (
sudo apt-get install subversion make gcc python-dev libc6-dev
):
- subversion
- make
- gcc
- python-dev
- libc6-dev
cd /usr/local/src
sudo svn co svn://svn.zope.org/repos/main/Zope3/trunk Zope3
cd Zope3
sudo make
sudo python test.py -v
(to run all the tests. note usesudo python test.py -vpf1
if a test fails and you want to know which one.)sudo ln -s /usr/local/src/Zope3/bin/mkzopeinstance /usr/local/bin/mkzopeinstance
Developers don't need sudo privileges for the following:
cd ~
(to get to your home directory)mkzopeinstance
- For
Directory:
we will be usingzope3
in the user's home directory (/home/<username>/zope3
). - Choose a username for the initial administrator account (for example
zopeuser
). - Select a password manager from among: Plain Text, MD5, and SHA1. (Text is least secure, SHA1 is most secure).
- Enter your password twice.
You should now have a zope3
directory inside your home directory containing an
instance of zope3.
Starting zope
As the developer from your home directory, there are two easy ways to start your zope3 instance:
./zope3/bin/runzope
./zope3/bin/zopectl start
For testing new code use runzope
. Messages and debugging information will
applear in the console, and you will be able to see when zope fails to start.
Keep in mind that when using runzope
the application server will stop when
you close the terminal from which it is run or interrupt it by typing Ctrl-C
, so to keep the server running
use zopectl start
. When running with zopectl start
, you can stop it
with zopectl stop
and check the status with zopectl status
.
If there will be other zope instances running on your machine, the default port, 8080, may already
be in use. To change the port on which your instance runs, do the following:
- edit
./zope3/etc/zope.conf
- change the section:
<server> type HTTP address 8080 </server>
to use the desired port.
Users should now be able to run your zope instance. To administer your instance, login with the username
you chose earlier (e.g. zopeuser
).
Setting PYTHONPATH
In order to be able to import and run your zope code from the command line, add the following
to the bottom of your.bashrc
file: PYTHONPATH=/usr/local/src/Zope3/src:$HOME/zope3/lib/python export PYTHONPATH
External Documentation
- http://www.treefernwebservices.co.nz/hello.html
- http://zissue.berlios.de/z3/hello.swf
- http://www.benjiyork.com/quick_start/
- http://zissue.berlios.de/z3/Zope3In30Minutes.html
- http://worldcookery.com/files/jeffshell-todo
- http://python.taupro.com/Zope3Notes/HowToContentComponent
- http://www.ibiblio.org/obp/pyBiblio/zope3