summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/_static/directory_structure_pyramid.pngbin10660 -> 16746 bytes
-rw-r--r--docs/quick_tutorial/authentication.rst6
-rw-r--r--docs/quick_tutorial/authorization.rst6
-rw-r--r--docs/quick_tutorial/databases.rst10
-rw-r--r--docs/quick_tutorial/debugtoolbar.rst8
-rw-r--r--docs/quick_tutorial/forms.rst6
-rw-r--r--docs/quick_tutorial/functional_testing.rst8
-rw-r--r--docs/quick_tutorial/hello_world.rst6
-rw-r--r--docs/quick_tutorial/index.rst3
-rw-r--r--docs/quick_tutorial/ini.rst8
-rw-r--r--docs/quick_tutorial/jinja2.rst10
-rw-r--r--docs/quick_tutorial/json.rst8
-rw-r--r--docs/quick_tutorial/logging.rst8
-rw-r--r--docs/quick_tutorial/more_view_classes.rst6
-rw-r--r--docs/quick_tutorial/package.rst8
-rw-r--r--docs/quick_tutorial/pyramid_setup.rst15
-rw-r--r--docs/quick_tutorial/python_setup.rst47
-rw-r--r--docs/quick_tutorial/request_response.rst8
-rw-r--r--docs/quick_tutorial/requirements.rst246
-rw-r--r--docs/quick_tutorial/routing.rst8
-rw-r--r--docs/quick_tutorial/scaffolds.rst10
-rw-r--r--docs/quick_tutorial/sessions.rst8
-rw-r--r--docs/quick_tutorial/static_assets.rst8
-rw-r--r--docs/quick_tutorial/templating.rst8
-rw-r--r--docs/quick_tutorial/tutorial_approach.rst40
-rw-r--r--docs/quick_tutorial/unit_testing.rst8
-rw-r--r--docs/quick_tutorial/view_classes.rst8
-rw-r--r--docs/quick_tutorial/views.rst8
28 files changed, 353 insertions, 170 deletions
diff --git a/docs/_static/directory_structure_pyramid.png b/docs/_static/directory_structure_pyramid.png
index 3dbe5995b..74edd6533 100644
--- a/docs/_static/directory_structure_pyramid.png
+++ b/docs/_static/directory_structure_pyramid.png
Binary files differ
diff --git a/docs/quick_tutorial/authentication.rst b/docs/quick_tutorial/authentication.rst
index 6eaec63df..8380a75ed 100644
--- a/docs/quick_tutorial/authentication.rst
+++ b/docs/quick_tutorial/authentication.rst
@@ -32,8 +32,8 @@ Steps
.. code-block:: bash
- (venv)$ cd ..; cp -r view_classes authentication; cd authentication
- (venv)$ python setup.py develop
+ $ cd ..; cp -r view_classes authentication; cd authentication
+ $ $VENV/bin/python setup.py develop
#. Put the security hash in the ``authentication/development.ini``
configuration file as ``tutorial.secret`` instead of putting it in
@@ -77,7 +77,7 @@ Steps
.. code-block:: bash
- (venv)$ pserve development.ini --reload
+ $ $VENV/bin/pserve development.ini --reload
#. Open http://localhost:6543/ in a browser.
diff --git a/docs/quick_tutorial/authorization.rst b/docs/quick_tutorial/authorization.rst
index ec85ce6ec..6b10d3409 100644
--- a/docs/quick_tutorial/authorization.rst
+++ b/docs/quick_tutorial/authorization.rst
@@ -37,8 +37,8 @@ Steps
.. code-block:: bash
- (venv)$ cd ..; cp -r authentication authorization; cd authorization
- (venv)$ python setup.py develop
+ $ cd ..; cp -r authentication authorization; cd authorization
+ $ $VENV/bin/python setup.py develop
#. Start by changing ``authorization/tutorial/__init__.py`` to
specify a root factory to the :term:`configurator`:
@@ -62,7 +62,7 @@ Steps
.. code-block:: bash
- (venv)$ pserve development.ini --reload
+ $ $VENV/bin/pserve development.ini --reload
#. Open http://localhost:6543/ in a browser.
diff --git a/docs/quick_tutorial/databases.rst b/docs/quick_tutorial/databases.rst
index e8786a046..978ef6982 100644
--- a/docs/quick_tutorial/databases.rst
+++ b/docs/quick_tutorial/databases.rst
@@ -41,7 +41,7 @@ Steps
.. code-block:: bash
- (venv)$ cd ..; cp -r forms databases; cd databases
+ $ cd ..; cp -r forms databases; cd databases
#. We need to add some dependencies in ``databases/setup.py`` as well
as an "entry point" for the command-line script:
@@ -75,7 +75,7 @@ Steps
.. code-block:: bash
- (venv)$ python setup.py develop
+ $ $VENV/bin/python setup.py develop
#. The script references some models in ``databases/tutorial/models.py``:
@@ -86,7 +86,7 @@ Steps
.. code-block:: bash
- (venv)$ initialize_tutorial_db development.ini
+ $ initialize_tutorial_db development.ini
2013-09-06 15:54:08,050 INFO [sqlalchemy.engine.base.Engine][MainThread] PRAGMA table_info("wikipages")
2013-09-06 15:54:08,050 INFO [sqlalchemy.engine.base.Engine][MainThread] ()
2013-09-06 15:54:08,051 INFO [sqlalchemy.engine.base.Engine][MainThread]
@@ -113,7 +113,7 @@ Steps
.. code-block:: bash
- (venv)$ nosetests .
+ $ $VENV/bin/nosetests .
..
-----------------------------------------------------------------
Ran 2 tests in 1.141s
@@ -124,7 +124,7 @@ Steps
.. code-block:: bash
- (venv)$ pserve development.ini --reload
+ $ $VENV/bin/pserve development.ini --reload
#. Open http://localhost:6543/ in a browser.
diff --git a/docs/quick_tutorial/debugtoolbar.rst b/docs/quick_tutorial/debugtoolbar.rst
index a5dd14ba1..6c711e2f2 100644
--- a/docs/quick_tutorial/debugtoolbar.rst
+++ b/docs/quick_tutorial/debugtoolbar.rst
@@ -33,9 +33,9 @@ Steps
.. code-block:: bash
- (venv)$ cd ..; cp -r ini debugtoolbar; cd debugtoolbar
- (venv)$ python setup.py develop
- (venv)$ easy_install pyramid_debugtoolbar
+ $ cd ..; cp -r ini debugtoolbar; cd debugtoolbar
+ $ $VENV/bin/python setup.py develop
+ $ $VENV/bin/easy_install pyramid_debugtoolbar
#. Our ``debugtoolbar/development.ini`` gets a configuration entry for
@@ -49,7 +49,7 @@ Steps
.. code-block:: bash
- (venv)$ pserve development.ini --reload
+ $ $VENV/bin/pserve development.ini --reload
#. Open http://localhost:6543/ in your browser. See the handy
toolbar on the right.
diff --git a/docs/quick_tutorial/forms.rst b/docs/quick_tutorial/forms.rst
index fdf052b39..0328ef528 100644
--- a/docs/quick_tutorial/forms.rst
+++ b/docs/quick_tutorial/forms.rst
@@ -36,7 +36,7 @@ Steps
.. code-block:: bash
- (venv)$ cd ..; cp -r view_classes forms; cd forms
+ $ cd ..; cp -r view_classes forms; cd forms
#. Let's edit ``forms/setup.py`` to declare a dependency on Deform
(which then pulls in Colander as a dependency:
@@ -48,7 +48,7 @@ Steps
.. code-block:: bash
- (venv)$ python setup.py develop
+ $ $VENV/bin/python setup.py develop
#. Register a static view in ``forms/tutorial/__init__.py`` for
Deform's CSS/JS etc. as well as our demo wikipage scenario's
@@ -88,7 +88,7 @@ Steps
.. code-block:: bash
- (venv)$ pserve development.ini --reload
+ $ $VENV/bin/pserve development.ini --reload
#. Open http://localhost:6543/ in a browser.
diff --git a/docs/quick_tutorial/functional_testing.rst b/docs/quick_tutorial/functional_testing.rst
index c7accdc4e..c9c99d76f 100644
--- a/docs/quick_tutorial/functional_testing.rst
+++ b/docs/quick_tutorial/functional_testing.rst
@@ -31,9 +31,9 @@ Steps
.. code-block:: bash
- (venv)$ cd ..; cp -r unit_testing functional_testing; cd functional_testing
- (venv)$ python setup.py develop
- (venv)$ easy_install webtest
+ $ cd ..; cp -r unit_testing functional_testing; cd functional_testing
+ $ $VENV/bin/python setup.py develop
+ $ $VENV/bin/easy_install webtest
#. Let's extend ``unit_testing/tutorial/tests.py`` to include a
functional test:
@@ -46,7 +46,7 @@ Steps
.. code-block:: bash
- (venv)$ nosetests tutorial
+ $ $VENV/bin/nosetests tutorial
.
----------------------------------------------------------------------
Ran 2 tests in 0.141s
diff --git a/docs/quick_tutorial/hello_world.rst b/docs/quick_tutorial/hello_world.rst
index 0898265ef..166f791fc 100644
--- a/docs/quick_tutorial/hello_world.rst
+++ b/docs/quick_tutorial/hello_world.rst
@@ -40,13 +40,13 @@ Objectives
Steps
=====
-#. Make sure you have followed the steps in :doc:`python_setup`.
+#. Make sure you have followed the steps in :doc:`requirements`.
#. Create a directory for this step:
.. code-block:: bash
- (venv)$ mkdir hello_world; cd hello_world
+ $ mkdir hello_world; cd hello_world
#. Copy the following into ``hello_world/app.py``:
@@ -57,7 +57,7 @@ Steps
.. code-block:: bash
- (venv)$ python app.py
+ $ $VENV/bin/python app.py
#. Open http://localhost:6543/ in your browser.
diff --git a/docs/quick_tutorial/index.rst b/docs/quick_tutorial/index.rst
index 857364731..9373fe38a 100644
--- a/docs/quick_tutorial/index.rst
+++ b/docs/quick_tutorial/index.rst
@@ -17,8 +17,7 @@ Contents
.. toctree::
:maxdepth: 1
- python_setup
- pyramid_setup
+ requirements
tutorial_approach
scaffolds
hello_world
diff --git a/docs/quick_tutorial/ini.rst b/docs/quick_tutorial/ini.rst
index f732d3653..35d6b46cc 100644
--- a/docs/quick_tutorial/ini.rst
+++ b/docs/quick_tutorial/ini.rst
@@ -35,7 +35,7 @@ Steps
.. code-block:: bash
- (venv)$ cd ..; cp -r package ini; cd ini
+ $ cd ..; cp -r package ini; cd ini
#. Our ``ini/setup.py`` needs a setuptools "entry point" in the
``setup()`` function:
@@ -48,7 +48,7 @@ Steps
.. code-block:: bash
- (venv)$ python setup.py develop
+ $ $VENV/bin/python setup.py develop
#. Let's make a file ``ini/development.ini`` for our configuration:
@@ -66,13 +66,13 @@ Steps
.. code-block:: bash
- (venv)$ rm tutorial/app.py
+ $ rm tutorial/app.py
#. Run your Pyramid application with:
.. code-block:: bash
- (venv)$ pserve development.ini --reload
+ $ $VENV/bin/pserve development.ini --reload
#. Open http://localhost:6543/.
diff --git a/docs/quick_tutorial/jinja2.rst b/docs/quick_tutorial/jinja2.rst
index 8b5c86a81..134ab39ca 100644
--- a/docs/quick_tutorial/jinja2.rst
+++ b/docs/quick_tutorial/jinja2.rst
@@ -23,9 +23,9 @@ Steps
.. code-block:: bash
- (venv)$ cd ..; cp -r view_classes jinja2; cd jinja2
- (venv)$ python setup.py develop
- (venv)$ easy_install pyramid_jinja2
+ $ cd ..; cp -r view_classes jinja2; cd jinja2
+ $ $VENV/bin/python setup.py develop
+ $ $VENV/bin/easy_install pyramid_jinja2
#. We need to add an item to ``pyramid.includes`` in
``jinja2/development.ini``:
@@ -54,13 +54,13 @@ Steps
.. code-block:: bash
- (venv)$ nosetests tutorial
+ $ $VENV/bin/nosetests tutorial
#. Run your Pyramid application with:
.. code-block:: bash
- (venv)$ pserve development.ini --reload
+ $ $VENV/bin/pserve development.ini --reload
#. Open http://localhost:6543/ in your browser.
diff --git a/docs/quick_tutorial/json.rst b/docs/quick_tutorial/json.rst
index 2d5c93106..c92e4eadd 100644
--- a/docs/quick_tutorial/json.rst
+++ b/docs/quick_tutorial/json.rst
@@ -28,8 +28,8 @@ Steps
.. code-block:: bash
- (venv)$ cd ..; cp -r view_classes json; cd json
- (venv)$ python setup.py develop
+ $ cd ..; cp -r view_classes json; cd json
+ $ $VENV/bin/python setup.py develop
#. We add a new route for ``hello_json`` in
``json/tutorial/__init__.py``:
@@ -53,13 +53,13 @@ Steps
.. code-block:: bash
- (venv)$ nosetests tutorial
+ $ $VENV/bin/nosetests tutorial
#. Run your Pyramid application with:
.. code-block:: bash
- (venv)$ pserve development.ini --reload
+ $ $VENV/bin/pserve development.ini --reload
#. Open http://localhost:6543/howdy.json in your browser and you
will see the resulting JSON response.
diff --git a/docs/quick_tutorial/logging.rst b/docs/quick_tutorial/logging.rst
index 6b3a2eda4..123e8e314 100644
--- a/docs/quick_tutorial/logging.rst
+++ b/docs/quick_tutorial/logging.rst
@@ -32,8 +32,8 @@ Steps
.. code-block:: bash
- (venv)$ cd ..; cp -r view_classes logging; cd logging
- (venv)$ python setup.py develop
+ $ cd ..; cp -r view_classes logging; cd logging
+ $ $VENV/bin/python setup.py develop
#. Extend ``logging/tutorial/views.py`` to log a message:
@@ -44,13 +44,13 @@ Steps
.. code-block:: bash
- (venv)$ nosetests tutorial
+ $ $VENV/bin/nosetests tutorial
#. Run your Pyramid application with:
.. code-block:: bash
- (venv)$ pserve development.ini --reload
+ $ $VENV/bin/pserve development.ini --reload
#. Open http://localhost:6543/ and http://localhost:6543/howdy
in your browser. Note, both in the console and in the debug
diff --git a/docs/quick_tutorial/more_view_classes.rst b/docs/quick_tutorial/more_view_classes.rst
index 0a06850ea..8b004f19d 100644
--- a/docs/quick_tutorial/more_view_classes.rst
+++ b/docs/quick_tutorial/more_view_classes.rst
@@ -55,8 +55,8 @@ Steps
.. code-block:: bash
- (venv)$ cd ..; cp -r templating more_view_classes; cd more_view_classes
- (venv)$ python setup.py develop
+ $ cd ..; cp -r templating more_view_classes; cd more_view_classes
+ $ $VENV/bin/python setup.py develop
#. Our route in ``more_view_classes/tutorial/__init__.py`` needs some
replacement patterns:
@@ -98,7 +98,7 @@ Steps
.. code-block:: bash
- (venv)$ pserve development.ini --reload
+ $ $VENV/bin/pserve development.ini --reload
#. Open http://localhost:6543/howdy/jane/doe in your browser. Click
the ``Save`` and ``Delete`` buttons and watch the output in the
diff --git a/docs/quick_tutorial/package.rst b/docs/quick_tutorial/package.rst
index 08cd02fc5..99a83b790 100644
--- a/docs/quick_tutorial/package.rst
+++ b/docs/quick_tutorial/package.rst
@@ -56,7 +56,7 @@ Steps
.. code-block:: bash
- (venv)$ cd ..; mkdir package; cd package
+ $ cd ..; mkdir package; cd package
#. In ``package/setup.py``, enter the following:
@@ -67,8 +67,8 @@ Steps
.. code-block:: bash
- (venv)$ python setup.py develop
- (venv)$ mkdir tutorial
+ $ $VENV/bin/python setup.py develop
+ $ $VENV/bin/mkdir tutorial
#. Enter the following into ``package/tutorial/__init__.py``:
@@ -82,7 +82,7 @@ Steps
.. code-block:: bash
- (venv)$ python tutorial/app.py
+ $ $VENV/bin/python tutorial/app.py
#. Open http://localhost:6543/ in your browser.
diff --git a/docs/quick_tutorial/pyramid_setup.rst b/docs/quick_tutorial/pyramid_setup.rst
deleted file mode 100644
index 187a25adf..000000000
--- a/docs/quick_tutorial/pyramid_setup.rst
+++ /dev/null
@@ -1,15 +0,0 @@
-=============
-Pyramid Setup
-=============
-
-We now have a standard starting point for Python. Getting Pyramid
-installed is easy:
-
-.. code-block:: bash
-
- $ easy_install pyramid
-
-Our virtual environment now has the Pyramid software available to its
-Python.
-
-.. seealso:: See Also: :ref:`installing_unix`
diff --git a/docs/quick_tutorial/python_setup.rst b/docs/quick_tutorial/python_setup.rst
deleted file mode 100644
index bdba214b9..000000000
--- a/docs/quick_tutorial/python_setup.rst
+++ /dev/null
@@ -1,47 +0,0 @@
-============
-Python Setup
-============
-
-.. note::
-
- This tutorial is aimed at Python 3.3. It also works with
- Python 2.7.
-
-First thing's first: we need our Python environment in ship-shape.
-Pyramid encourages standard Python development practices (virtual
-environments, packaging tools, logging, etc.) so let's get our working
-area in place. For Python 3.3:
-
-.. code-block:: bash
-
- $ pyvenv-3.3 venv
- $ source env/bin/activate
- (venv)$ wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py -O - | python
-
-If ``wget`` complains with a certificate error, run it with:
-
-.. code-block:: bash
-
- $ wget --no-check-certificate
-
-In these steps above we first made a :term:`virtualenv` and then
-"activated" it, which adjusted our path to look first in
-``venv/bin`` for commands (such as ``python``). We next downloaded
-Python's packaging support and installed it, giving us the
-``easy_install`` command-line script for adding new packages. Python
-2.7 users will need to use ``virtualenv`` instead of ``pyvenv`` to make
-their virtual environment.
-
-.. note::
-
- Why ``easy_install`` and not ``pip``? Pyramid encourages use of
- namespace packages which, until recently, ``pip`` didn't permit.
- Also, Pyramid has some optional C extensions for performance. With
- ``easy_install``, Windows users can get these extensions without
- needing a C compiler.
-
-.. seealso:: See Also: Python 3's :mod:`venv module <python3:venv>`,
- the ``setuptools`` `installation
- instructions <https://pypi.python.org/pypi/setuptools/0.9.8#installation-instructions>`_,
- `easy_install help <https://pypi.python.org/pypi/setuptools/0.9.8#using-setuptools-and-easyinstall>`_,
- and Pyramid's :ref:`Before You Install <installing_chapter>`.
diff --git a/docs/quick_tutorial/request_response.rst b/docs/quick_tutorial/request_response.rst
index 6a7e0f0c2..fc5ea020d 100644
--- a/docs/quick_tutorial/request_response.rst
+++ b/docs/quick_tutorial/request_response.rst
@@ -38,8 +38,8 @@ Steps
.. code-block:: bash
- (venv)$ cd ..; cp -r view_classes request_response; cd request_response
- (venv)$ python setup.py develop
+ $ cd ..; cp -r view_classes request_response; cd request_response
+ $ $VENV/bin/python setup.py develop
#. Simplify the routes in ``request_response/tutorial/__init__.py``:
@@ -57,13 +57,13 @@ Steps
.. code-block:: bash
- (venv)$ nosetests tutorial
+ $ $VENV/bin/nosetests tutorial
#. Run your Pyramid application with:
.. code-block:: bash
- (venv)$ pserve development.ini --reload
+ $ $VENV/bin/pserve development.ini --reload
#. Open http://localhost:6543/ in your browser. You will be
redirected to http://localhost:6543/plain
diff --git a/docs/quick_tutorial/requirements.rst b/docs/quick_tutorial/requirements.rst
new file mode 100644
index 000000000..4c71d0fdd
--- /dev/null
+++ b/docs/quick_tutorial/requirements.rst
@@ -0,0 +1,246 @@
+============
+Requirements
+============
+
+Let's get our tutorial environment setup. Most of the setup work is in
+standard Python development practices (install Python,
+make an isolated environment, and setup packaging tools.)
+
+.. note::
+
+ Pyramid encourages standard Python development practices with
+ packaging tools, virtual environments, logging, and so on. There
+ are many variations, implementations, and opinions across the Python
+ community. For consistency, ease of documentation maintenance,
+ and to minimize confusion, the Pyramid *documentation* has adopted
+ specific conventions.
+
+This *Quick Tutorial* is based on:
+
+* **Python 3.3**. Pyramid fully supports Python 3.2+ and Python 2.6+.
+ This tutorial uses **Python 3.3** but runs fine under Python 2.7.
+
+* **pyvenv**. We believe in virtual environments. For this tutorial,
+ we use Python 3.3's built-in solution, the ``pyvenv`` command.
+ For Python 2.7, you can install ``virtualenv``.
+
+* **setuptools and easy_install**. We use
+ `setuptools <https://pypi.python.org/pypi/setuptools/>`_
+ and its ``easy_install`` for package management.
+
+* **Workspaces, projects, and packages.** Our home directory
+ will contain a *tutorial workspace* with our Python virtual
+ environment(s) and *Python projects* (a directory with packaging
+ information and *Python packages* of working code.)
+
+* **Unix commands**. Commands in this tutorial use UNIX syntax and
+ paths. Windows users should adjust commands accordingly.
+
+.. note::
+
+ Pyramid was one of the first web frameworks to fully support Python 3 in
+ October 2011.
+
+Steps
+=====
+
+#. :ref:`install-python-3.3-or-greater`
+#. :ref:`create-a-project-directory-structure`
+#. :ref:`set-an-environment-variable`
+#. :ref:`create-a-virtual-environment`
+#. :ref:`install-setuptools-(python-packaging-tools)`
+#. :ref:`install-pyramid`
+
+.. _install-python-3.3-or-greater:
+
+Install Python 3.3 or greater
+-----------------------------
+
+Download the latest standard Python 3.3+ release (not development
+release) from
+`python.org <http://www.python.org/download/releases/>`_. On that page, you
+must click the latest version, then scroll down to the "Downloads" section
+for your operating system.
+
+Windows and Mac OS X users can download and run an installer.
+
+Windows users should also install the `Python for Windows extensions
+<http://sourceforge.net/projects/pywin32/files/pywin32/>`_. Carefully read the
+``README.txt`` file at the end of the list of builds, and follow its
+directions. Make sure you get the proper 32- or 64-bit build and Python
+version.
+
+Linux users can either use their package manager to install Python 3.3
+or may
+`build Python 3.3 from source
+<http://pyramid.readthedocs.org/en/master/narr/install.html#package-manager-
+method>`_.
+
+
+.. _create-a-project-directory-structure:
+
+Create a project directory structure
+------------------------------------
+
+We will arrive at a directory structure of
+``workspace->project->package``, with our workspace named
+``quick_tutorial``. The following diagram shows how this is structured
+and where our virtual environment will reside:
+
+.. figure:: ../_static/directory_structure_pyramid.png
+ :alt: Final directory structure
+
+ Final directory structure.
+
+The commands to do so are as follows:
+
+.. code-block:: bash
+
+ # Mac and Linux
+ $ cd ~
+ $ mkdir projects
+ $ cd projects
+ $ mkdir quick_tutorial
+ $ cd quick_tutorial
+
+ # Windows
+ c:\> cd \
+ c:\> mkdir projects
+ c:\> cd projects
+ c:\> mkdir quick_tutorial
+ c:\> cd quick_tutorial
+
+In the above figure, your user home directory is represented by ``~``. In
+your home directory, all of your projects are in the ``projects`` directory.
+This is a general convention not specific to Pyramid that many developers use.
+Windows users will do well to use ``c:\`` as the location for ``projects`` in
+order to avoid spaces in any of the path names.
+
+Next within ``projects`` is your workspace directory, here named
+``quick_tutorial``. A workspace is a common term used by integrated
+development environments (IDE) like PyCharm and PyDev that stores
+isolated Python environments (virtualenvs) and specific project files
+and repositories.
+
+
+.. _set-an-environment-variable:
+
+Set an Environment Variable
+---------------------------
+
+This tutorial will refer frequently to the location of the virtual
+environment. We set an environment variable to save typing later.
+
+.. code-block:: bash
+
+ # Mac and Linux
+ $ export VENV=~/projects/quick_tutorial/env33/
+
+ # Windows
+ # TODO: This command does not work
+ c:\> set VENV=c:\projects\quick_tutorial\env33
+
+
+.. _create-a-virtual-environment:
+
+Create a Virtual Environment
+----------------------------
+
+.. warning:: The current state of isolated Python environments using
+ ``pyvenv`` on Windows is suboptimal in comparison to Mac and Linux. See
+ http://stackoverflow.com/q/15981111/95735 for a discussion of the issue
+ and `PEP 453 <http://www.python.org/dev/peps/pep-0453/>`_ for a proposed
+ resolution.
+
+``pyvenv`` is a tool to create isolated Python 3.3 environments, each
+with its own Python binary and independent set of installed Python
+packages in its site directories. Let's create one, using the location
+we just specified in the environment variable.
+
+.. code-block:: bash
+
+ # Mac and Linux
+ $ pyvenv $VENV
+
+ # Windows
+ c:\> c:\Python33\python -m venv %VENV%
+
+.. seealso:: See also Python 3's :mod:`venv module <python3:venv>`,
+ Python 2's `virtualenv <http://www.virtualenv.org/en/latest/>`_
+ package,
+ :ref:`Installing Pyramid on a Windows System <installing_windows>`
+
+
+.. _install-setuptools-(python-packaging-tools):
+
+Install ``setuptools`` (Python packaging tools)
+-----------------------------------------------
+
+The following command will download a script to install ``setuptools``, then
+pipe it to your environment's version of Python.
+
+.. code-block:: bash
+
+ # Mac and Linux
+ $ wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py -O - | $VENV/bin/python
+
+ # Windows
+ # Use your browser to download:
+ # https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.p
+ # ...into c:\projects\quick_tutorial\ez_setup.py
+ c:\> %VENV%\Scripts\python ez_setup.py
+
+If ``wget`` complains with a certificate error, then run this command instead:
+
+.. code-block:: bash
+
+ # Mac and Linux
+ $ wget --no-check-certificate https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py -O - | $VENV/bin/python
+
+
+.. _install-pyramid:
+
+Install Pyramid
+---------------
+
+We have our Python standard prerequisites out of the way. The Pyramid
+part is pretty easy:
+
+.. code-block:: bash
+
+ # Mac and Linux
+ $ easy_install pyramid
+
+ # Windows
+ c:\> %VENV%\Scripts\easy_install pyramid
+
+Our Python virtual environment now has the Pyramid software available.
+
+You can optionally install some of the extra Python packages used
+during this tutorial:
+
+.. code-block:: bash
+
+ # Mac and Linux
+ $ easy_install nose webtest deform sqlalchemy
+
+ # Windows
+ c:\> %VENV%\Scripts\easy_install nose webtest deform sqlalchemy
+
+
+
+.. note::
+
+ Why ``easy_install`` and not ``pip``? Pyramid encourages use of namespace
+ packages which, until recently, ``pip`` didn't permit. Also, Pyramid has
+ some optional C extensions for performance. With ``easy_install``, Windows
+ users can get these extensions without needing a C compiler.
+
+.. seealso:: See Also: :ref:`installing_unix`. For instructions to set up your
+ Python environment for development using Windows or Python 2, see Pyramid's
+ :ref:`Before You Install <installing_chapter>`.
+
+ See also Python 3's :mod:`venv module <python3:venv>`, the `setuptools` `installation instructions
+ <https://pypi.python.org/pypi/setuptools/0.9.8#installation-instructions>`_,
+ and `easy_install help <https://pypi.python.org/pypi/setuptools/0.9.8#using-setuptools-and-easyinstall>`_.
+
diff --git a/docs/quick_tutorial/routing.rst b/docs/quick_tutorial/routing.rst
index 86fc04570..bfae69615 100644
--- a/docs/quick_tutorial/routing.rst
+++ b/docs/quick_tutorial/routing.rst
@@ -45,8 +45,8 @@ Steps
.. code-block:: bash
- (venv)$ cd ..; cp -r view_classes routing; cd routing
- (venv)$ python setup.py develop
+ $ cd ..; cp -r view_classes routing; cd routing
+ $ $VENV/bin/python setup.py develop
#. Our ``routing/tutorial/__init__.py`` needs a route with a replacement
pattern:
@@ -74,13 +74,13 @@ Steps
.. code-block:: bash
- (venv)$ nosetests tutorial
+ $ $VENV/bin/nosetests tutorial
#. Run your Pyramid application with:
.. code-block:: bash
- (venv)$ pserve development.ini --reload
+ $ $VENV/bin/pserve development.ini --reload
#. Open http://localhost:6543/howdy/amy/smith in your browser.
diff --git a/docs/quick_tutorial/scaffolds.rst b/docs/quick_tutorial/scaffolds.rst
index 7adfe8aa0..c8f6d5c66 100644
--- a/docs/quick_tutorial/scaffolds.rst
+++ b/docs/quick_tutorial/scaffolds.rst
@@ -33,7 +33,7 @@ Steps
.. code-block:: bash
- (venv)$ pcreate --list
+ $ $VENV/bin/pcreate --list
Available scaffolds:
alchemy: Pyramid SQLAlchemy project using url dispatch
starter: Pyramid starter project
@@ -43,21 +43,21 @@ Steps
.. code-block:: bash
- (venv)$ pcreate --scaffold starter scaffolds
+ $ $VENV/bin/pcreate --scaffold starter scaffolds
#. Use normal Python development to setup our project for development:
.. code-block:: bash
- (venv)$ cd scaffolds
- (venv)$ python setup.py develop
+ $ cd scaffolds
+ $ $VENV/bin/python setup.py develop
#. Startup the application by pointing Pyramid's ``pserve`` command at
the project's (generated) configuration file:
.. code-block:: bash
- (venv)$ pserve development.ini --reload
+ $ $VENV/bin/pserve development.ini --reload
On startup, ``pserve`` logs some output:
diff --git a/docs/quick_tutorial/sessions.rst b/docs/quick_tutorial/sessions.rst
index 4dd60079d..56980f6ee 100644
--- a/docs/quick_tutorial/sessions.rst
+++ b/docs/quick_tutorial/sessions.rst
@@ -31,8 +31,8 @@ Steps
.. code-block:: bash
- (venv)$ cd ..; cp -r view_classes sessions; cd sessions
- (venv)$ python setup.py develop
+ $ cd ..; cp -r view_classes sessions; cd sessions
+ $ $VENV/bin/python setup.py develop
#. Our ``sessions/tutorial/__init__.py`` needs a choice of session
factory to get registered with the :term:`configurator`:
@@ -56,13 +56,13 @@ Steps
.. code-block:: bash
- (venv)$ nosetests tutorial
+ $ $VENV/bin/nosetests tutorial
#. Run your Pyramid application with:
.. code-block:: bash
- (venv)$ pserve development.ini --reload
+ $ $VENV/bin/pserve development.ini --reload
#. Open http://localhost:6543/ and http://localhost:6543/howdy
in your browser. As you reload and switch between those URLs, note
diff --git a/docs/quick_tutorial/static_assets.rst b/docs/quick_tutorial/static_assets.rst
index 1d6afae18..3ac2d6f08 100644
--- a/docs/quick_tutorial/static_assets.rst
+++ b/docs/quick_tutorial/static_assets.rst
@@ -20,8 +20,8 @@ Steps
.. code-block:: bash
- (venv)$ cd ..; cp -r view_classes static_assets; cd static_assets
- (venv)$ python setup.py develop
+ $ cd ..; cp -r view_classes static_assets; cd static_assets
+ $ $VENV/bin/python setup.py develop
#. We add a call ``config.add_static_view in
``static_assets/tutorial/__init__.py``:
@@ -45,13 +45,13 @@ Steps
.. code-block:: bash
- (venv)$ nosetests tutorial
+ $ $VENV/bin/nosetests tutorial
#. Run your Pyramid application with:
.. code-block:: bash
- (venv)$ pserve development.ini --reload
+ $ $VENV/bin/pserve development.ini --reload
#. Open http://localhost:6543/ in your browser.
diff --git a/docs/quick_tutorial/templating.rst b/docs/quick_tutorial/templating.rst
index 254629e57..ba236d9da 100644
--- a/docs/quick_tutorial/templating.rst
+++ b/docs/quick_tutorial/templating.rst
@@ -36,8 +36,8 @@ Steps
.. code-block:: bash
- (venv)$ cd ..; cp -r views templating; cd templating
- (venv)$ python setup.py develop
+ $ cd ..; cp -r views templating; cd templating
+ $ $VENV/bin/python setup.py develop
#. Our ``templating/tutorial/views.py`` no longer has HTML in it:
@@ -66,7 +66,7 @@ Steps
.. code-block:: bash
- (venv)$ nosetests tutorial
+ $ $VENV/bin/nosetests tutorial
.
----------------------------------------------------------------------
Ran 4 tests in 0.141s
@@ -77,7 +77,7 @@ Steps
.. code-block:: bash
- (venv)$ pserve development.ini --reload
+ $ $VENV/bin/pserve development.ini --reload
#. Open http://localhost:6543/ and http://localhost:6543/howdy
in your browser.
diff --git a/docs/quick_tutorial/tutorial_approach.rst b/docs/quick_tutorial/tutorial_approach.rst
index 80af1b3d4..52d768306 100644
--- a/docs/quick_tutorial/tutorial_approach.rst
+++ b/docs/quick_tutorial/tutorial_approach.rst
@@ -2,13 +2,11 @@
Tutorial Approach
=================
-In summary:
+This tutorial uses conventions to keep the introduction focused and
+concise. Details, references, and deeper discussions are mentioned in
+"See Also" notes.
-- Tutorial broken into topics with quick working examples
-
-- Each step is a Python *package* with working code in the repo
-
-- Setup each step with ``python setup.py develop``
+.. seealso:: This is an example "See Also" note.
This "Getting Started" tutorial is broken into independent steps,
starting with the smallest possible "single file WSGI app" example.
@@ -19,7 +17,7 @@ repo, where each step/topic/directory is a Python package.
To successfully run each step::
$ cd request_response
- $ python setup.py develop
+ $ $VENV/bin/python setup.py develop
...and repeat for each step you would like to work on. In most cases we
will start with the results of an earlier step.
@@ -30,16 +28,18 @@ Directory Tree
As we develop our tutorial our directory tree will resemble the
structure below::
- request_response/
- development.ini
- setup.py
- tutorial/
- __init__.py
- home.pt
- tests.py
- views.py
-
-Each of the first-level directories are a *Python project*
-(except, as noted, the first.) The ``tutorial`` directory is a *Python
-package*. At the end of each step, we copy the old directory into a new
-directory to use as a starting point. \ No newline at end of file
+ quicktutorial/
+ request_response/
+ development.ini
+ setup.py
+ tutorial/
+ __init__.py
+ home.pt
+ tests.py
+ views.py
+
+Each of the first-level directories (e.g. ``request_response``) is a
+*Python project* (except, as noted, the ``hello_world`` step.) The
+``tutorial`` directory is a *Python package*. At the end of each step,
+we copy a previous directory into a new directory to use as a starting
+point. \ No newline at end of file
diff --git a/docs/quick_tutorial/unit_testing.rst b/docs/quick_tutorial/unit_testing.rst
index de30ea436..a71ad0097 100644
--- a/docs/quick_tutorial/unit_testing.rst
+++ b/docs/quick_tutorial/unit_testing.rst
@@ -45,9 +45,9 @@ Steps
.. code-block:: bash
- (venv)$ cd ..; cp -r debugtoolbar unit_testing; cd unit_testing
- (venv)$ python setup.py develop
- (venv)$ easy_install nose
+ $ cd ..; cp -r debugtoolbar unit_testing; cd unit_testing
+ $ $VENV/bin/python setup.py develop
+ $ $VENV/bin/easy_install nose
#. Now we write a simple unit test in ``unit_testing/tutorial/tests.py``:
@@ -59,7 +59,7 @@ Steps
.. code-block:: bash
- (venv)$ nosetests tutorial
+ $ $VENV/bin/nosetests tutorial
.
----------------------------------------------------------------------
Ran 1 test in 0.141s
diff --git a/docs/quick_tutorial/view_classes.rst b/docs/quick_tutorial/view_classes.rst
index 22f2b2430..b55abf218 100644
--- a/docs/quick_tutorial/view_classes.rst
+++ b/docs/quick_tutorial/view_classes.rst
@@ -39,8 +39,8 @@ Steps
.. code-block:: bash
- (venv)$ cd ..; cp -r templating view_classes; cd view_classes
- (venv)$ python setup.py develop
+ $ cd ..; cp -r templating view_classes; cd view_classes
+ $ $VENV/bin/python setup.py develop
#. Our ``view_classes/tutorial/views.py`` now has a view class with
our two views:
@@ -60,7 +60,7 @@ Steps
.. code-block:: bash
- (venv)$ nosetests tutorial
+ $ $VENV/bin/nosetests tutorial
.
----------------------------------------------------------------------
Ran 4 tests in 0.141s
@@ -71,7 +71,7 @@ Steps
.. code-block:: bash
- (venv)$ pserve development.ini --reload
+ $ $VENV/bin/pserve development.ini --reload
#. Open http://localhost:6543/ and http://localhost:6543/howdy
in your browser.
diff --git a/docs/quick_tutorial/views.rst b/docs/quick_tutorial/views.rst
index 0902c45dd..78f038d91 100644
--- a/docs/quick_tutorial/views.rst
+++ b/docs/quick_tutorial/views.rst
@@ -40,8 +40,8 @@ Steps
.. code-block:: bash
- (venv)$ cd ..; cp -r function_testing views; cd views
- (venv)$ python setup.py develop
+ $ cd ..; cp -r function_testing views; cd views
+ $ $VENV/bin/python setup.py develop
#. Our ``views/tutorial/__init__.py`` gets a lot shorter:
@@ -64,7 +64,7 @@ Steps
.. code-block:: bash
- (venv)$ nosetests tutorial
+ $ $VENV/bin/nosetests tutorial
.
----------------------------------------------------------------------
Ran 4 tests in 0.141s
@@ -75,7 +75,7 @@ Steps
.. code-block:: bash
- (venv)$ pserve development.ini --reload
+ $ $VENV/bin/pserve development.ini --reload
#. Open http://localhost:6543/ and http://localhost:6543/howdy
in your browser.