summaryrefslogtreecommitdiff
path: root/docs/quick_tour.rst
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2018-03-13 17:19:44 -0400
committerChris McDonough <chrism@plope.com>2018-03-13 17:19:44 -0400
commitbf59bd87ce2d8dc35f9585087623528bb58363a3 (patch)
treeea5cb12fee6e4453bb8e0bf6b943e1451de7cc73 /docs/quick_tour.rst
parentb2e8884a94d9e869bf29ea55298ad308f16ed420 (diff)
parent47ff29297c65ae2c8da06a5bb2f361f806681ced (diff)
downloadpyramid-bf59bd87ce2d8dc35f9585087623528bb58363a3.tar.gz
pyramid-bf59bd87ce2d8dc35f9585087623528bb58363a3.tar.bz2
pyramid-bf59bd87ce2d8dc35f9585087623528bb58363a3.zip
Merge branch 'master' of github.com:Pylons/pyramid
Diffstat (limited to 'docs/quick_tour.rst')
-rw-r--r--docs/quick_tour.rst55
1 files changed, 28 insertions, 27 deletions
diff --git a/docs/quick_tour.rst b/docs/quick_tour.rst
index 053846276..c6e696ae3 100644
--- a/docs/quick_tour.rst
+++ b/docs/quick_tour.rst
@@ -46,7 +46,7 @@ For Windows:
# set an environment variable to where you want your virtual environment
c:\\> set VENV=c:\\env
# create the virtual environment
- c:\\> %VENV%\\Scripts\\python -m venv %VENV%
+ c:\\> python -m venv %VENV%
# install pyramid
c:\\> %VENV%\\Scripts\\pip install pyramid
# or for a specific released version
@@ -90,7 +90,7 @@ explanation:
#. *Line 10*. ``if __name__ == '__main__':`` is Python's way of saying "Start
here when running from the command line".
-#. *Lines 11-13*. Use Pyramid's :term:`configurator` to connect :term:`view`
+#. *Lines 11-13*. Use Pyramid's :term:`configurator` in a :term:`context manager` to connect :term:`view`
code to a particular URL :term:`route`.
#. *Lines 6-7*. Implement the view code that generates the :term:`response`.
@@ -510,14 +510,21 @@ Let's use the cookiecutter ``pyramid-cookiecutter-starter`` to create a starter
.. code-block:: bash
- $ $VENV/bin/cookiecutter https://github.com/Pylons/pyramid-cookiecutter-starter
+ $ $VENV/bin/cookiecutter gh:Pylons/pyramid-cookiecutter-starter --checkout master
If prompted for the first item, accept the default ``yes`` by hitting return.
-#. ``You've cloned ~/.cookiecutters/pyramid-cookiecutter-starter before. Is it
- okay to delete and re-clone it? [yes]:``
-#. ``project_name [Pyramid Scaffold]: hello_world``
-#. ``repo_name [scaffold]: hello_world``
+.. code-block:: text
+
+ You've cloned ~/.cookiecutters/pyramid-cookiecutter-starter before.
+ Is it okay to delete and re-clone it? [yes]: yes
+ project_name [Pyramid Scaffold]: hello_world
+ repo_name [hello_world]: hello_world
+ Select template_language:
+ 1 - jinja2
+ 2 - chameleon
+ 3 - mako
+ Choose from 1, 2, 3 [1]: 1
We then run through the following commands.
@@ -611,7 +618,7 @@ We have a few decisions made for us in this configuration:
#. *Choice of web server:* ``use = egg:waitress#main`` tells ``pserve`` to
use the ``waitress`` server.
-#. *Interfaces:* ``listen = 127.0.0.1:6543 [::1]:6543`` tells ``waitress`` to listen on all interfaces on port 6543 for both IPv4 and IPv6.
+#. *Interfaces:* ``listen = localhost:6543`` tells ``waitress`` to listen on all interfaces on port 6543 for both IPv4 and IPv6.
Additionally the ``development.ini`` generated by this cookiecutter wired up
Python's standard logging. We'll now see in the console, for example, a log on
@@ -640,8 +647,8 @@ add-on ``pyramid_debugtoolbar`` in its ``setup.py``:
.. literalinclude:: quick_tour/package/setup.py
:language: python
:lineno-match:
- :lines: 11-16
- :emphasize-lines: 4
+ :lines: 11-17
+ :emphasize-lines: 5
It was installed when you previously ran:
@@ -650,14 +657,7 @@ It was installed when you previously ran:
$ $VENV/bin/pip install -e ".[testing]"
The ``pyramid_debugtoolbar`` package is a Pyramid add-on, which means we need
-to include its configuration into our web application. The cookiecutter already took care of this for us in its ``__init__.py``:
-
-.. literalinclude:: quick_tour/package/hello_world/__init__.py
- :language: python
- :lineno-match:
- :lines: 8
-
-And it uses the ``pyramid.includes`` facility in our ``development.ini``:
+to include its configuration into our web application. The cookiecutter already took care of this for us in its ``development.ini`` using the ``pyramid.includes`` facility:
.. literalinclude:: quick_tour/package/development.ini
:language: ini
@@ -685,18 +685,17 @@ before its release.
Our ``pyramid-cookiecutter-starter`` cookiecutter generated a ``tests.py`` module with
one unit test and one functional test in it. It also configured ``setup.py`` with test requirements:
``py.test`` as the test runner, ``WebTest`` for running view tests, and the
-``pytest-cov`` tool which yells at us for code that isn't tested. The
-highlighted lines show this:
+``pytest-cov`` tool which yells at us for code that isn't tested:
.. literalinclude:: quick_tour/package/setup.py
:language: python
:lineno-match:
- :lines: 18-22
+ :lines: 19-23
.. literalinclude:: quick_tour/package/setup.py
:language: python
:lineno-match:
- :lines: 42-44
+ :lines: 43-45
We already installed the test requirements when we ran the command ``$VENV/bin/pip install -e ".[testing]"``. We can now run all our tests:
@@ -859,14 +858,16 @@ Pyramid and SQLAlchemy are great friends. That friendship includes a cookiecutte
.. code-block:: bash
$ cd ~
- $ env/bin/cookiecutter https://github.com/Pylons/pyramid-cookiecutter-alchemy
+ $ env/bin/cookiecutter gh:Pylons/pyramid-cookiecutter-alchemy --checkout master
If prompted for the first item, accept the default ``yes`` by hitting return.
-#. ``You've cloned ~/.cookiecutters/pyramid-cookiecutter-alchemy before. Is it
- okay to delete and re-clone it? [yes]:``
-#. ``project_name [Pyramid Scaffold]: sqla_demo``
-#. ``repo_name [scaffold]: sqla_demo``
+.. code-block:: text
+
+ You've cloned ~/.cookiecutters/pyramid-cookiecutter-alchemy before.
+ Is it okay to delete and re-clone it? [yes]: yes
+ project_name [Pyramid Scaffold]: sqla_demo
+ repo_name [sqla_demo]: sqla_demo
We then run through the following commands as before.