Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 264 lines (163 sloc) 7.127 kB
e53e134 @mcdonc rename bfgwiki to wiki
mcdonc authored
1 ============
2 Installation
3 ============
4
5 For the most part, the installation process for this tutorial
6 duplicates the steps described in :ref:`installing_chapter` and
7 :ref:`project_narr`, however it also explains how to install
8 additional libraries for tutorial purposes.
9
10 Preparation
11 ========================
12
13 Please take the following steps to prepare for the tutorial. The
14 steps to prepare for the tutorial are slightly different depending on
15 whether you're using UNIX or Windows.
16
17 Preparation, UNIX
18 -----------------
19
20 #. If you don't already have a Python 2.6 interpreter installed on
21 your system, obtain, install, or find `Python 2.6
22 <http://python.org/download/releases/2.6.6/>`_ for your system.
23
24 #. Install the latest `setuptools` into the Python you
25 obtained/installed/found in the step above: download `ez_setup.py
26 <http://peak.telecommunity.com/dist/ez_setup.py>`_ and run it using
27 the ``python`` interpreter of your Python 2.6 installation:
28
be3d6f9 @blaflamme Updated wiki tutorial docs
blaflamme authored
29 .. code-block:: text
e53e134 @mcdonc rename bfgwiki to wiki
mcdonc authored
30
31 $ /path/to/my/Python-2.6/bin/python ez_setup.py
32
33 #. Use that Python's `bin/easy_install` to install `virtualenv`:
34
be3d6f9 @blaflamme Updated wiki tutorial docs
blaflamme authored
35 .. code-block:: text
e53e134 @mcdonc rename bfgwiki to wiki
mcdonc authored
36
37 $ /path/to/my/Python-2.6/bin/easy_install virtualenv
38
39 #. Use that Python's virtualenv to make a workspace:
40
be3d6f9 @blaflamme Updated wiki tutorial docs
blaflamme authored
41 .. code-block:: text
e53e134 @mcdonc rename bfgwiki to wiki
mcdonc authored
42
43 $ path/to/my/Python-2.6/bin/virtualenv --no-site-packages \
be3d6f9 @blaflamme Updated wiki tutorial docs
blaflamme authored
44 pyramidtut
e53e134 @mcdonc rename bfgwiki to wiki
mcdonc authored
45
be3d6f9 @blaflamme Updated wiki tutorial docs
blaflamme authored
46 #. Switch to the ``pyramidtut`` directory:
e53e134 @mcdonc rename bfgwiki to wiki
mcdonc authored
47
be3d6f9 @blaflamme Updated wiki tutorial docs
blaflamme authored
48 .. code-block:: text
e53e134 @mcdonc rename bfgwiki to wiki
mcdonc authored
49
be3d6f9 @blaflamme Updated wiki tutorial docs
blaflamme authored
50 $ cd pyramidtut
e53e134 @mcdonc rename bfgwiki to wiki
mcdonc authored
51
52 #. (Optional) Consider using ``source bin/activate`` to make your
53 shell environment wired to use the virtualenv.
54
fd5ae92 @mcdonc - All references to Pyramid-the-application were changed from :mod:`p…
mcdonc authored
55 #. Use ``easy_install`` to get :app:`Pyramid` and its direct
e53e134 @mcdonc rename bfgwiki to wiki
mcdonc authored
56 dependencies installed:
57
be3d6f9 @blaflamme Updated wiki tutorial docs
blaflamme authored
58 .. code-block:: text
e53e134 @mcdonc rename bfgwiki to wiki
mcdonc authored
59
60 $ bin/easy_install pyramid
61
62 #. Use ``easy_install`` to install ``docutils``, ``repoze.tm``,
63 ``repoze.zodbconn``, ``nose`` and ``coverage``:
64
be3d6f9 @blaflamme Updated wiki tutorial docs
blaflamme authored
65 .. code-block:: text
e53e134 @mcdonc rename bfgwiki to wiki
mcdonc authored
66
67 $ bin/easy_install docutils repoze.tm repoze.zodbconn \
68 nose coverage
69
70 Preparation, Windows
71 --------------------
72
73 #. Install, or find `Python 2.6
74 <http://python.org/download/releases/2.6.6/>`_ for your system.
75
76 #. Install the latest `setuptools` into the Python you
77 obtained/installed/found in the step above: download `ez_setup.py
78 <http://peak.telecommunity.com/dist/ez_setup.py>`_ and run it using
79 the ``python`` interpreter of your Python 2.6 installation using a
80 command prompt:
81
be3d6f9 @blaflamme Updated wiki tutorial docs
blaflamme authored
82 .. code-block:: text
e53e134 @mcdonc rename bfgwiki to wiki
mcdonc authored
83
84 c:\> c:\Python26\python ez_setup.py
85
86 #. Use that Python's `bin/easy_install` to install `virtualenv`:
87
be3d6f9 @blaflamme Updated wiki tutorial docs
blaflamme authored
88 .. code-block:: text
e53e134 @mcdonc rename bfgwiki to wiki
mcdonc authored
89
90 c:\> c:\Python26\Scripts\easy_install virtualenv
91
92 #. Use that Python's virtualenv to make a workspace:
93
be3d6f9 @blaflamme Updated wiki tutorial docs
blaflamme authored
94 .. code-block:: text
e53e134 @mcdonc rename bfgwiki to wiki
mcdonc authored
95
be3d6f9 @blaflamme Updated wiki tutorial docs
blaflamme authored
96 c:\> c:\Python26\Scripts\virtualenv --no-site-packages pyramidtut
e53e134 @mcdonc rename bfgwiki to wiki
mcdonc authored
97
be3d6f9 @blaflamme Updated wiki tutorial docs
blaflamme authored
98 #. Switch to the ``pyramidtut`` directory:
e53e134 @mcdonc rename bfgwiki to wiki
mcdonc authored
99
be3d6f9 @blaflamme Updated wiki tutorial docs
blaflamme authored
100 .. code-block:: text
e53e134 @mcdonc rename bfgwiki to wiki
mcdonc authored
101
be3d6f9 @blaflamme Updated wiki tutorial docs
blaflamme authored
102 c:\> cd pyramidtut
e53e134 @mcdonc rename bfgwiki to wiki
mcdonc authored
103
104 #. (Optional) Consider using ``bin\activate.bat`` to make your shell
105 environment wired to use the virtualenv.
106
fd5ae92 @mcdonc - All references to Pyramid-the-application were changed from :mod:`p…
mcdonc authored
107 #. Use ``easy_install`` to get :app:`Pyramid` and its direct
e53e134 @mcdonc rename bfgwiki to wiki
mcdonc authored
108 dependencies installed:
109
be3d6f9 @blaflamme Updated wiki tutorial docs
blaflamme authored
110 .. code-block:: text
e53e134 @mcdonc rename bfgwiki to wiki
mcdonc authored
111
be3d6f9 @blaflamme Updated wiki tutorial docs
blaflamme authored
112 c:\pyramidtut> Scripts\easy_install pyramid
e53e134 @mcdonc rename bfgwiki to wiki
mcdonc authored
113
114 #. Use ``easy_install`` to install ``docutils``, ``repoze.tm``,
115 ``repoze.zodbconn``, ``nose`` and ``coverage``:
116
be3d6f9 @blaflamme Updated wiki tutorial docs
blaflamme authored
117 .. code-block:: text
e53e134 @mcdonc rename bfgwiki to wiki
mcdonc authored
118
be3d6f9 @blaflamme Updated wiki tutorial docs
blaflamme authored
119 c:\pyramidtut> Scripts\easy_install docutils repoze.tm \
e53e134 @mcdonc rename bfgwiki to wiki
mcdonc authored
120 repoze.zodbconn nose coverage
121
122 .. _making_a_project:
123
124 Making a Project
125 ================
126
fd5ae92 @mcdonc - All references to Pyramid-the-application were changed from :mod:`p…
mcdonc authored
127 Your next step is to create a project. :app:`Pyramid` supplies a
e53e134 @mcdonc rename bfgwiki to wiki
mcdonc authored
128 variety of templates to generate sample projects. For this tutorial,
129 we will use the :term:`ZODB` -oriented template named ``pyramid_zodb``.
130
131 The below instructions assume your current working directory is the
be3d6f9 @blaflamme Updated wiki tutorial docs
blaflamme authored
132 "virtualenv" named "pyramidtut".
e53e134 @mcdonc rename bfgwiki to wiki
mcdonc authored
133
134 On UNIX:
135
be3d6f9 @blaflamme Updated wiki tutorial docs
blaflamme authored
136 .. code-block:: text
e53e134 @mcdonc rename bfgwiki to wiki
mcdonc authored
137
138 $ bin/paster create -t pyramid_zodb tutorial
139
140 On Windows:
141
be3d6f9 @blaflamme Updated wiki tutorial docs
blaflamme authored
142 .. code-block:: text
e53e134 @mcdonc rename bfgwiki to wiki
mcdonc authored
143
be3d6f9 @blaflamme Updated wiki tutorial docs
blaflamme authored
144 c:\pyramidtut> Scripts\paster create -t pyramid_zodb tutorial
e53e134 @mcdonc rename bfgwiki to wiki
mcdonc authored
145
146 .. note:: If you are using Windows, the ``pyramid_zodb`` Paster template
147 doesn't currently deal gracefully with installation into a location
148 that contains spaces in the path. If you experience startup
149 problems, try putting both the virtualenv and the project into
150 directories that do not contain spaces in their paths.
151
152 Installing the Project in "Development Mode"
153 ============================================
154
155 In order to do development on the project easily, you must "register"
156 the project as a development egg in your workspace using the
157 ``setup.py develop`` command. In order to do so, cd to the "tutorial"
158 directory you created in :ref:`making_a_project`, and run the
159 "setup.py develop" command using virtualenv Python interpreter.
160
161 On UNIX:
162
be3d6f9 @blaflamme Updated wiki tutorial docs
blaflamme authored
163 .. code-block:: text
e53e134 @mcdonc rename bfgwiki to wiki
mcdonc authored
164
165 $ cd tutorial
166 $ ../bin/python setup.py develop
167
168 On Windows:
169
be3d6f9 @blaflamme Updated wiki tutorial docs
blaflamme authored
170 .. code-block:: text
e53e134 @mcdonc rename bfgwiki to wiki
mcdonc authored
171
be3d6f9 @blaflamme Updated wiki tutorial docs
blaflamme authored
172 C:\pyramidtut> cd tutorial
173 C:\pyramidtut\tutorial> ..\Scripts\python setup.py develop
e53e134 @mcdonc rename bfgwiki to wiki
mcdonc authored
174
175 .. _running_tests:
176
177 Running the Tests
178 =================
179
180 After you've installed the project in development mode, you may run
181 the tests for the project.
182
183 On UNIX:
184
be3d6f9 @blaflamme Updated wiki tutorial docs
blaflamme authored
185 .. code-block:: text
e53e134 @mcdonc rename bfgwiki to wiki
mcdonc authored
186
187 $ ../bin/python setup.py test -q
188
189 On Windows:
190
be3d6f9 @blaflamme Updated wiki tutorial docs
blaflamme authored
191 .. code-block:: text
e53e134 @mcdonc rename bfgwiki to wiki
mcdonc authored
192
be3d6f9 @blaflamme Updated wiki tutorial docs
blaflamme authored
193 c:\pyramidtut\tutorial> ..\Scripts\python setup.py test -q
e53e134 @mcdonc rename bfgwiki to wiki
mcdonc authored
194
195 Starting the Application
196 ========================
197
198 Start the application.
199
200 On UNIX:
201
be3d6f9 @blaflamme Updated wiki tutorial docs
blaflamme authored
202 .. code-block:: text
e53e134 @mcdonc rename bfgwiki to wiki
mcdonc authored
203
6badd81 @mcdonc tutorial.ini -> development.ini
mcdonc authored
204 $ ../bin/paster serve development.ini --reload
e53e134 @mcdonc rename bfgwiki to wiki
mcdonc authored
205
206 On Windows:
207
be3d6f9 @blaflamme Updated wiki tutorial docs
blaflamme authored
208 .. code-block:: text
e53e134 @mcdonc rename bfgwiki to wiki
mcdonc authored
209
be3d6f9 @blaflamme Updated wiki tutorial docs
blaflamme authored
210 c:\pyramidtut\tutorial> ..\Scripts\paster serve development.ini --reload
e53e134 @mcdonc rename bfgwiki to wiki
mcdonc authored
211
212 Exposing Test Coverage Information
213 ==================================
214
215 You can run the ``nosetests`` command to see test coverage
216 information. This runs the tests in the same way that ``setup.py
217 test`` does but provides additional "coverage" information, exposing
218 which lines of your project are "covered" (or not covered) by the
219 tests.
220
221 On UNIX:
222
be3d6f9 @blaflamme Updated wiki tutorial docs
blaflamme authored
223 .. code-block:: text
e53e134 @mcdonc rename bfgwiki to wiki
mcdonc authored
224
225 $ ../bin/nosetests --cover-package=tutorial --cover-erase --with-coverage
226
227 On Windows:
228
be3d6f9 @blaflamme Updated wiki tutorial docs
blaflamme authored
229 .. code-block:: text
e53e134 @mcdonc rename bfgwiki to wiki
mcdonc authored
230
be3d6f9 @blaflamme Updated wiki tutorial docs
blaflamme authored
231 c:\pyramidtut\tutorial> ..\Scripts\nosetests --cover-package=tutorial \
e53e134 @mcdonc rename bfgwiki to wiki
mcdonc authored
232 --cover-erase --with-coverage
233
234 Looks like the code in the ``pyramid_zodb`` template for ZODB projects is
235 missing some test coverage, particularly in the file named
236 ``models.py``.
237
238 Visit the Application in a Browser
239 ==================================
240
241 In a browser, visit `http://localhost:6543/ <http://localhost:6543>`_.
242 You will see the generated application's default page.
243
244 Decisions the ``pyramid_zodb`` Template Has Made For You
245 ========================================================
246
b3b7132 @mcdonc - The ZODB Wiki tutorial was updated to take into account changes to the
mcdonc authored
247 Creating a project using the ``pyramid_zodb`` template makes the following
248 assumptions:
249
250 - you are willing to use :term:`ZODB` as persistent storage
251
252 - you are willing to use :term:`traversal` to map URLs to code.
253
2eb2a8f @mcdonc amend decisions
mcdonc authored
254 - you want to use imperative code plus a :term:`scan` to perform
255 configuration.
b3b7132 @mcdonc - The ZODB Wiki tutorial was updated to take into account changes to the
mcdonc authored
256
257 .. note::
258
fd5ae92 @mcdonc - All references to Pyramid-the-application were changed from :mod:`p…
mcdonc authored
259 :app:`Pyramid` supports any persistent storage mechanism (e.g. a SQL
260 database or filesystem files, etc). :app:`Pyramid` also supports an
b3b7132 @mcdonc - The ZODB Wiki tutorial was updated to take into account changes to the
mcdonc authored
261 additional mechanism to map URLs to code (:term:`URL dispatch`). However,
262 for the purposes of this tutorial, we'll only be using traversal and ZODB.
e53e134 @mcdonc rename bfgwiki to wiki
mcdonc authored
263
Something went wrong with that request. Please try again.