Creating a z3ext project

You can use the z3extproject sample application generator to get started. This generator uses Paste templates to aid in the creation of a new project.

Creating the Project

Let’s create a first z3ext project. A z3ext project is a working environment for a developer using z3ext. In essence, a directory with a lot of files and subdirectories in it. Let’s create a z3ext project called sample using the interpreter from the virtualenv (virtualz3ext) directory you created in Setting up z3extproject.

1
$ bin/z3extproject sample

This tells z3extproject to create a new subdirectory called sample and set up the project in there. z3extproject will automatically download and install the Zope libraries as well as z3ext libraries into the project area.

z3extproject asks you for an initial username and password for the server. We’ll use z3ext for both:

1
2
Enter user (Name of an initial administrator user): z3ext
Enter passwd (Password for the initial administrator user): z3ext

Now you have to wait while z3extproject downloads and installs the various tools and libraries that are needed in a z3ext project. The second time you create a z3ext project it will be faster as it can reuse the previously installed libraries. After all that your z3ext project is ready to go.

Starting up the web server

You can go into the sample project directory now and start up the web server for our project:

1
2
$ cd sample
$ bin/zopectl fg

This will make z3ext available on port 8080. You can log in with username z3ext and password z3ext. Assuming you’ve started up the web server on your development computer, you can go to it here:

http://localhost:8080

You can shut down the server at any time by hitting CTRL-c. Shut it down now. We will be shutting down and starting up the server often in this tutorial.

Running The Tests For Your Application

To run unit tests for your application, you should invoke them like so:

1
$ bin/test

Here’s sample output from a test run:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
$ bin/test
Running tests at level 1
Running sample.tests.tests.FunctionalLayer tests:
  Set up sample.tests.tests.FunctionalLayer...
  in 17.157 seconds.
  Running:
  ...
  Ran 3 tests with 0 failures and 0 errors in 1.284 seconds.
Tearing down left over layers:
  Tear down sample.tests.tests.FunctionalLayer in 0.005 seconds.

All tests localed in sample/src/sample/tests directory

Table Of Contents

Previous topic

Setting up z3extproject

Next topic

Control panel

This Page