summaryrefslogtreecommitdiff
path: root/docs/develop-example.txt
blob: efc871b86266b77825679f9580e70ec48233eb8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
Development With Paste: An Example
++++++++++++++++++++++++++++++++++

This example uses `WebKit </webkit/>`_, `SQLObject
<http://sqlobject.org>`_, and `Zope Page Templates <>`_, 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 <>`_, 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 <>`_ 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 <>`_ 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 ...