[Zope3-Users] Announcing zopeproject 0.4

Philipp von Weitershausen philipp at weitershausen.de
Sun Sep 16 11:01:56 EDT 2007


zopeproject makes it easy to get started with a web application based on
Zope eggs, zc.buildout and WSGI/Paste. If you're not familiar with this
world yet, zopeproject is your easy entry to it. If you are, zopeproject
will save you lots of typing up the boilerplate.

Why eggs?
---------

Because they are a great way to distribute Python software and declare
its dependencies. Zope 3.4 is completely distributed as individual eggs
and will from now on be developed as such.

What's zc.buildout?
-------------------

It's a tool for repeatable deployments that's configuration-file driven.
You tell it "install these eggs for me, create this script and let me
develop packages in this directory" and it will go ahead and do all
that. Over and over again, if necessary, and for everybody who wants the
same setup as you (which is great for teams).

What are WSGI and Paste?
------------------------

WSGI is a Python standard for web applications and web servers. It
defines how they communicate so that potentially any WSGI application
can run on any WSGI gateway (server). Zope has had support for WSGI for
a while now, but it has never really been exposed, even though it offers
great possibilities such as middlewares.

Paste is a collection of related to WSGI. One of its tools, PasteDeploy,
is of particular interest. It allows you to plug WSGI applications,
middlwares and gateways together using a simple configuration file.

zopeproject vs. instances
-------------------------

Apart from all the flashy technology that zopeproject brings us, it also
implies a big conceptual change in the way we develop web applications
with Zope.

In the world of regular instances, Zope is the server and the
application. Your code is just like a plug-in::

   +------------+         +---------+
   |    Zope    |  runs   |your code|
   |server & app|  ---->  | (plugin)|
   +------------+         +---------+

Even though we've been doing it for years ("Products" ring any bells?),
I think this is backwards and accounts for much of the irritation people
coming to Zope have.

With zopeproject's approach, *your code* is the application. The web
application, to be precise. And it *happens* to use Zope. As a library::

   +------------+           +-------------+          +---------+
   |WSGI gateway|  serves   |  your code  |   uses   |  Zope   |
   |  (server)  |  ------>  |(application)|   ---->  |libraries|
   +------------+           +-------------+          +---------+

Zope isn't the center of attention anymore, your application is. Even
better, you can choose how much of Zope you'd really like to use. You
may compare this approach to a GUI application that happens to use some
sort of GUI framework to get some widgets on the screen, but otherwise
it's just like any other, real application.

So how does it work?
--------------------

It's pretty easy. All you need to do is install zopeproject first. You
don't need to install Zope for this, zopeproject will do that for you
later. Note that you will have to have setuptools installed for this
to work (it provides the easy_install script)::

   $ easy_install zopeproject

Depending on where and how you installed Python, you may have to prefix
this command with "sudo" to gain privileges for installing packages
globally.

Now you can create a new web application::

  $ zopeproject WebApp

Much like with mkzopeinstance, you'll be asked a couple of questions.
The last question concerns the central download location for eggs (which
will include the Zope eggs). After the questions, zopeproject will
create a 'WebApp' directory with some initial directory structure, as
well as download and install the Zope eggs.

To start the application, go to the newly created directory and invoke
the server::

   $ cd WebApp
   $ bin/paster serve deploy.ini

You may also use the webapp-ctl script which works much like zopectl::

   $ bin/webapp-ctl fg

You will then be able to go to http://localhost:8080 and see the default
Zope screen (The standard boilerplate simply uses the Zope 3 default,
after all. It is now up to you to change that.)

More information and feedback
-----------------------------

For more information, please refer to zopeproject's homepage on PyPI:
http://pypi.python.org/pypi/zopeproject

I'm very much interested in getting your feedback. Please direct
questions that are of public interest to the zope3-users at zope.org list.
Bugs may be reported in Launchpad: https://launchpad.net/zopeproject.


-- 
http://worldcookery.com -- Professional Zope documentation and training




More information about the Zope3-users mailing list