Development With Paste: An Example
++++++++++++++++++++++++++++++++++

This example uses `WebKit </webkit/>`_, `SQLObject
<http://sqlobject.org>`_, and `Zope Page Templates
<http://www.zope.org/DevHome/Wikis/DevSite/Projects/ZPT/>`_, but it's
all pluggable for other frameworks and tools.

Paste enabled applications are all proper Python packages, and even
moreso they are installable by `easy_install
<http://peak.telecommunity.com/DevCenter/EasyInstall>`_, including
Paste itself::

    $ easy_install PasteScript PasteWebKit SQLObject ZPTKit 
    ... messages fly by ...

This example also uses Subversion repository (we'll assume you've set
up a repository with ``svnadmin create /home/me/testrepos``).  When
you create a project, you can create a layout in your repository for
it.

This will create the new project::
    
    $ paster create --template=webkit --template=zpt \
        --svn-repository=file:///home/me/testrepos Wiki 
    ... the package is setup in the repository ...
    ... file listings fly by ...
    $ cd Wiki
    $ svn commit -m "New project"
    ... messages about committing ...

The basic setup has a simplest of applications already set up; you can
test everything is working by running::

    $ paster serve --reload docs/devel_config.ini
    ... now your new app is served on http://localhost:8080/ ...
    ... ^C to quit

It also has set up a `py.test
<http://codespeak.net/py/current/doc/test.html>`_ fixture for you, so
you can run the first test (which just tests that the front page loads
up properly):

    $ py.test -v
    ... test results ...

Using the ``webkit`` template we've also added a new command for
setting up new servlets::

    $ paster servlet listing
    ... @@: creating files ... 

Also, all the metadata for SQLObject has been added to the template,
and can be used like::

    $ sqlobject-admin create --egg=Wiki
    ... database create statements ...

You can add version information to your model as well, so that you can
develop and record your updates, and then apply them to old versions
of the database.

Once you've made something you are ready to deploy, you can use
`buildutils <http://buildutils.lesscode.org/>`_ to tag it for
release::

    $ python setup.py svntag --version=0.1 -b ../Wiki01
    $ cd ../Wiki01
    $ python setup.py sdist
    ... boring messages ...
    ... @@: Deploy stuff ...

And then deploy it on another server::

    $ ssh other-server
    ... @@: More deploy stuff ...

