summaryrefslogtreecommitdiff
path: root/docs/quick_tutorial
diff options
context:
space:
mode:
Diffstat (limited to 'docs/quick_tutorial')
-rw-r--r--docs/quick_tutorial/authentication.rst2
-rw-r--r--docs/quick_tutorial/authentication/development.ini4
-rw-r--r--docs/quick_tutorial/authentication/setup.py1
-rw-r--r--docs/quick_tutorial/authentication/tutorial/views.py3
-rw-r--r--docs/quick_tutorial/authorization/development.ini4
-rw-r--r--docs/quick_tutorial/authorization/setup.py1
-rw-r--r--docs/quick_tutorial/authorization/tutorial/views.py3
-rw-r--r--docs/quick_tutorial/cookiecutters.rst16
-rw-r--r--docs/quick_tutorial/cookiecutters/README.txt2
-rw-r--r--docs/quick_tutorial/cookiecutters/cc_starter/templates/layout.jinja212
-rw-r--r--docs/quick_tutorial/cookiecutters/cc_starter/templates/mytemplate.jinja22
-rw-r--r--docs/quick_tutorial/cookiecutters/development.ini6
-rw-r--r--docs/quick_tutorial/cookiecutters/production.ini4
-rw-r--r--docs/quick_tutorial/databases/development.ini4
-rw-r--r--docs/quick_tutorial/databases/setup.py1
-rw-r--r--docs/quick_tutorial/debugtoolbar.rst2
-rw-r--r--docs/quick_tutorial/debugtoolbar/development.ini4
-rw-r--r--docs/quick_tutorial/debugtoolbar/setup.py1
-rw-r--r--docs/quick_tutorial/forms.rst2
-rw-r--r--docs/quick_tutorial/forms/development.ini4
-rw-r--r--docs/quick_tutorial/forms/setup.py1
-rw-r--r--docs/quick_tutorial/functional_testing.rst2
-rw-r--r--docs/quick_tutorial/functional_testing/development.ini4
-rw-r--r--docs/quick_tutorial/functional_testing/setup.py1
-rw-r--r--docs/quick_tutorial/hello_world.rst2
-rw-r--r--docs/quick_tutorial/hello_world/app.py13
-rw-r--r--docs/quick_tutorial/ini.rst14
-rw-r--r--docs/quick_tutorial/ini/development.ini4
-rw-r--r--docs/quick_tutorial/ini/setup.py1
-rw-r--r--docs/quick_tutorial/jinja2.rst2
-rw-r--r--docs/quick_tutorial/jinja2/development.ini4
-rw-r--r--docs/quick_tutorial/jinja2/setup.py1
-rw-r--r--docs/quick_tutorial/json/development.ini4
-rw-r--r--docs/quick_tutorial/json/setup.py1
-rw-r--r--docs/quick_tutorial/logging/development.ini4
-rw-r--r--docs/quick_tutorial/logging/setup.py1
-rw-r--r--docs/quick_tutorial/more_view_classes/development.ini4
-rw-r--r--docs/quick_tutorial/more_view_classes/setup.py1
-rw-r--r--docs/quick_tutorial/package.rst2
-rw-r--r--docs/quick_tutorial/package/tutorial/app.py15
-rw-r--r--docs/quick_tutorial/request_response/development.ini4
-rw-r--r--docs/quick_tutorial/request_response/setup.py1
-rw-r--r--docs/quick_tutorial/requirements.rst9
-rw-r--r--docs/quick_tutorial/retail_forms/development.ini4
-rw-r--r--docs/quick_tutorial/retail_forms/setup.py1
-rw-r--r--docs/quick_tutorial/routing.rst2
-rw-r--r--docs/quick_tutorial/routing/development.ini4
-rw-r--r--docs/quick_tutorial/routing/setup.py1
-rw-r--r--docs/quick_tutorial/sessions/development.ini4
-rw-r--r--docs/quick_tutorial/sessions/setup.py1
-rw-r--r--docs/quick_tutorial/static_assets.rst11
-rw-r--r--docs/quick_tutorial/static_assets/development.ini4
-rw-r--r--docs/quick_tutorial/static_assets/setup.py1
-rw-r--r--docs/quick_tutorial/static_assets/tutorial/tests.py4
-rw-r--r--docs/quick_tutorial/templating/development.ini4
-rw-r--r--docs/quick_tutorial/templating/setup.py1
-rw-r--r--docs/quick_tutorial/unit_testing.rst2
-rw-r--r--docs/quick_tutorial/unit_testing/development.ini4
-rw-r--r--docs/quick_tutorial/unit_testing/setup.py1
-rw-r--r--docs/quick_tutorial/view_classes.rst2
-rw-r--r--docs/quick_tutorial/view_classes/development.ini4
-rw-r--r--docs/quick_tutorial/view_classes/setup.py1
-rw-r--r--docs/quick_tutorial/views/development.ini4
-rw-r--r--docs/quick_tutorial/views/setup.py1
64 files changed, 139 insertions, 95 deletions
diff --git a/docs/quick_tutorial/authentication.rst b/docs/quick_tutorial/authentication.rst
index 892beb3ec..684cce6a6 100644
--- a/docs/quick_tutorial/authentication.rst
+++ b/docs/quick_tutorial/authentication.rst
@@ -39,7 +39,7 @@ Steps
.. literalinclude:: authentication/setup.py
:language: python
- :emphasize-lines: 5-6
+ :emphasize-lines: 7
:linenos:
#. We can now install our project in development mode:
diff --git a/docs/quick_tutorial/authentication/development.ini b/docs/quick_tutorial/authentication/development.ini
index a4586d45f..cae509542 100644
--- a/docs/quick_tutorial/authentication/development.ini
+++ b/docs/quick_tutorial/authentication/development.ini
@@ -6,5 +6,5 @@ pyramid.includes =
tutorial.secret = 98zd
[server:main]
-use = egg:pyramid#wsgiref
-port = 6543
+use = egg:waitress#main
+listen = localhost:6543
diff --git a/docs/quick_tutorial/authentication/setup.py b/docs/quick_tutorial/authentication/setup.py
index 7a6ff4226..808a6f9a9 100644
--- a/docs/quick_tutorial/authentication/setup.py
+++ b/docs/quick_tutorial/authentication/setup.py
@@ -2,6 +2,7 @@ from setuptools import setup
requires = [
'pyramid',
+ 'waitress',
'pyramid_chameleon',
'bcrypt'
]
diff --git a/docs/quick_tutorial/authentication/tutorial/views.py b/docs/quick_tutorial/authentication/tutorial/views.py
index b07538d5e..b2d9354ec 100644
--- a/docs/quick_tutorial/authentication/tutorial/views.py
+++ b/docs/quick_tutorial/authentication/tutorial/views.py
@@ -43,7 +43,8 @@ class TutorialViews:
if 'form.submitted' in request.params:
login = request.params['login']
password = request.params['password']
- if check_password(password, USERS.get(login)):
+ hashed_pw = USERS.get(login)
+ if hashed_pw and check_password(password, hashed_pw):
headers = remember(request, login)
return HTTPFound(location=came_from,
headers=headers)
diff --git a/docs/quick_tutorial/authorization/development.ini b/docs/quick_tutorial/authorization/development.ini
index a4586d45f..cae509542 100644
--- a/docs/quick_tutorial/authorization/development.ini
+++ b/docs/quick_tutorial/authorization/development.ini
@@ -6,5 +6,5 @@ pyramid.includes =
tutorial.secret = 98zd
[server:main]
-use = egg:pyramid#wsgiref
-port = 6543
+use = egg:waitress#main
+listen = localhost:6543
diff --git a/docs/quick_tutorial/authorization/setup.py b/docs/quick_tutorial/authorization/setup.py
index 7a6ff4226..808a6f9a9 100644
--- a/docs/quick_tutorial/authorization/setup.py
+++ b/docs/quick_tutorial/authorization/setup.py
@@ -2,6 +2,7 @@ from setuptools import setup
requires = [
'pyramid',
+ 'waitress',
'pyramid_chameleon',
'bcrypt'
]
diff --git a/docs/quick_tutorial/authorization/tutorial/views.py b/docs/quick_tutorial/authorization/tutorial/views.py
index b2dc905c0..3876efb1c 100644
--- a/docs/quick_tutorial/authorization/tutorial/views.py
+++ b/docs/quick_tutorial/authorization/tutorial/views.py
@@ -45,7 +45,8 @@ class TutorialViews:
if 'form.submitted' in request.params:
login = request.params['login']
password = request.params['password']
- if check_password(password, USERS.get(login)):
+ hashed_pw = USERS.get(login)
+ if hashed_pw and check_password(password, hashed_pw):
headers = remember(request, login)
return HTTPFound(location=came_from,
headers=headers)
diff --git a/docs/quick_tutorial/cookiecutters.rst b/docs/quick_tutorial/cookiecutters.rst
index 8e7048f78..f8568206d 100644
--- a/docs/quick_tutorial/cookiecutters.rst
+++ b/docs/quick_tutorial/cookiecutters.rst
@@ -28,13 +28,21 @@ Steps
.. 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]: cc_starter``
- #. ``repo_name [scaffold]: cc_starter``
+ .. 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]: cc_starter
+ repo_name [cc_starter]: cc_starter
+ Select template_language:
+ 1 - jinja2
+ 2 - chameleon
+ 3 - mako
+ Choose from 1, 2, 3 [1]: 1
#. We then run through the following commands.
diff --git a/docs/quick_tutorial/cookiecutters/README.txt b/docs/quick_tutorial/cookiecutters/README.txt
index 4b1f31bf3..55c5dcec6 100644
--- a/docs/quick_tutorial/cookiecutters/README.txt
+++ b/docs/quick_tutorial/cookiecutters/README.txt
@@ -1,5 +1,5 @@
cc_starter
-===============================
+==========
Getting Started
---------------
diff --git a/docs/quick_tutorial/cookiecutters/cc_starter/templates/layout.jinja2 b/docs/quick_tutorial/cookiecutters/cc_starter/templates/layout.jinja2
index 20da74879..13a65ff72 100644
--- a/docs/quick_tutorial/cookiecutters/cc_starter/templates/layout.jinja2
+++ b/docs/quick_tutorial/cookiecutters/cc_starter/templates/layout.jinja2
@@ -11,15 +11,15 @@
<title>Cookiecutter Starter project for the Pyramid Web Framework</title>
<!-- Bootstrap core CSS -->
- <link href="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
+ <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Custom styles for this scaffold -->
<link href="{{request.static_url('cc_starter:static/theme.css')}}" rel="stylesheet">
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
- <script src="//oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
- <script src="//oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
+ <script src="//oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js" integrity="sha384-0s5Pv64cNZJieYFkXYOTId2HMA2Lfb6q2nAcx2n0RTLUnCAoTTsS0nKEO27XyKcY" crossorigin="anonymous"></script>
+ <script src="//oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js" integrity="sha384-ZoaMbDF+4LeFxg6WdScQ9nnR1QC2MIRxA1O9KWEXQwns1G8UNyIEZIQidzb0T1fo" crossorigin="anonymous"></script>
<![endif]-->
</head>
@@ -42,7 +42,7 @@
<ul>
<li><i class="glyphicon glyphicon-cog icon-muted"></i><a href="https://github.com/Pylons/pyramid">Github Project</a></li>
<li><i class="glyphicon glyphicon-globe icon-muted"></i><a href="https://webchat.freenode.net/?channels=pyramid">IRC Channel</a></li>
- <li><i class="glyphicon glyphicon-home icon-muted"></i><a href="http://pylonsproject.org">Pylons Project</a></li>
+ <li><i class="glyphicon glyphicon-home icon-muted"></i><a href="https://pylonsproject.org">Pylons Project</a></li>
</ul>
</div>
</div>
@@ -58,7 +58,7 @@
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
- <script src="//oss.maxcdn.com/libs/jquery/1.10.2/jquery.min.js"></script>
- <script src="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/js/bootstrap.min.js"></script>
+ <script src="//code.jquery.com/jquery-1.12.4.min.js" integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=" crossorigin="anonymous"></script>
+ <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</body>
</html>
diff --git a/docs/quick_tutorial/cookiecutters/cc_starter/templates/mytemplate.jinja2 b/docs/quick_tutorial/cookiecutters/cc_starter/templates/mytemplate.jinja2
index 979ee5071..f2e7283f8 100644
--- a/docs/quick_tutorial/cookiecutters/cc_starter/templates/mytemplate.jinja2
+++ b/docs/quick_tutorial/cookiecutters/cc_starter/templates/mytemplate.jinja2
@@ -3,6 +3,6 @@
{% block content %}
<div class="content">
<h1><span class="font-semi-bold">Pyramid</span> <span class="smaller">Starter project</span></h1>
- <p class="lead">Welcome to <span class="font-normal">cc_starter</span>, a&nbsp;Pyramid application generated&nbsp;by<br><span class="font-normal">Cookiecutter</span>.</p>
+ <p class="lead">Welcome to <span class="font-normal">{{project}}</span>, a&nbsp;Pyramid application generated&nbsp;by<br><span class="font-normal">Cookiecutter</span>.</p>
</div>
{% endblock content %}
diff --git a/docs/quick_tutorial/cookiecutters/development.ini b/docs/quick_tutorial/cookiecutters/development.ini
index 86b54b51d..ec621169d 100644
--- a/docs/quick_tutorial/cookiecutters/development.ini
+++ b/docs/quick_tutorial/cookiecutters/development.ini
@@ -1,6 +1,6 @@
###
# app configuration
-# http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/environment.html
+# https://docs.pylonsproject.org/projects/pyramid/en/latest/narr/environment.html
###
[app:main]
@@ -24,11 +24,11 @@ pyramid.includes =
[server:main]
use = egg:waitress#main
-listen = 127.0.0.1:6543 [::1]:6543
+listen = localhost:6543
###
# logging configuration
-# http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/logging.html
+# https://docs.pylonsproject.org/projects/pyramid/en/latest/narr/logging.html
###
[loggers]
diff --git a/docs/quick_tutorial/cookiecutters/production.ini b/docs/quick_tutorial/cookiecutters/production.ini
index e24a065b1..8d2b9c79d 100644
--- a/docs/quick_tutorial/cookiecutters/production.ini
+++ b/docs/quick_tutorial/cookiecutters/production.ini
@@ -1,6 +1,6 @@
###
# app configuration
-# http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/environment.html
+# https://docs.pylonsproject.org/projects/pyramid/en/latest/narr/environment.html
###
[app:main]
@@ -22,7 +22,7 @@ listen = *:6543
###
# logging configuration
-# http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/logging.html
+# https://docs.pylonsproject.org/projects/pyramid/en/latest/narr/logging.html
###
[loggers]
diff --git a/docs/quick_tutorial/databases/development.ini b/docs/quick_tutorial/databases/development.ini
index 270643071..270cf7b63 100644
--- a/docs/quick_tutorial/databases/development.ini
+++ b/docs/quick_tutorial/databases/development.ini
@@ -8,8 +8,8 @@ pyramid.includes =
sqlalchemy.url = sqlite:///%(here)s/sqltutorial.sqlite
[server:main]
-use = egg:pyramid#wsgiref
-port = 6543
+use = egg:waitress#main
+listen = localhost:6543
# Begin logging configuration
diff --git a/docs/quick_tutorial/databases/setup.py b/docs/quick_tutorial/databases/setup.py
index 238358fe4..66045fd7e 100644
--- a/docs/quick_tutorial/databases/setup.py
+++ b/docs/quick_tutorial/databases/setup.py
@@ -2,6 +2,7 @@ from setuptools import setup
requires = [
'pyramid',
+ 'waitress',
'pyramid_chameleon',
'deform',
'sqlalchemy',
diff --git a/docs/quick_tutorial/debugtoolbar.rst b/docs/quick_tutorial/debugtoolbar.rst
index b02363d40..4402fcdbd 100644
--- a/docs/quick_tutorial/debugtoolbar.rst
+++ b/docs/quick_tutorial/debugtoolbar.rst
@@ -75,7 +75,7 @@ configuration for the debugtoolbar.
You'll now see an attractive button on the right side of your browser, which
you may click to provide introspective access to debugging information in a new
-rowser tab. Even better, if your web application generates an error, you will
+browser tab. Even better, if your web application generates an error, you will
see a nice traceback on the screen. When you want to disable this toolbar,
there's no need to change code: you can remove it from ``pyramid.includes`` in
the relevant ``.ini`` configuration file (thus showing why configuration files
diff --git a/docs/quick_tutorial/debugtoolbar/development.ini b/docs/quick_tutorial/debugtoolbar/development.ini
index 17b479011..58d23cff7 100644
--- a/docs/quick_tutorial/debugtoolbar/development.ini
+++ b/docs/quick_tutorial/debugtoolbar/development.ini
@@ -4,5 +4,5 @@ pyramid.includes =
pyramid_debugtoolbar
[server:main]
-use = egg:pyramid#wsgiref
-port = 6543
+use = egg:waitress#main
+listen = localhost:6543
diff --git a/docs/quick_tutorial/debugtoolbar/setup.py b/docs/quick_tutorial/debugtoolbar/setup.py
index 9997984d3..a93cf6a73 100644
--- a/docs/quick_tutorial/debugtoolbar/setup.py
+++ b/docs/quick_tutorial/debugtoolbar/setup.py
@@ -2,6 +2,7 @@ from setuptools import setup
requires = [
'pyramid',
+ 'waitress',
]
setup(name='tutorial',
diff --git a/docs/quick_tutorial/forms.rst b/docs/quick_tutorial/forms.rst
index 84ceb13d6..3c865ad09 100644
--- a/docs/quick_tutorial/forms.rst
+++ b/docs/quick_tutorial/forms.rst
@@ -41,7 +41,7 @@ Steps
pulls in Colander as a dependency:
.. literalinclude:: forms/setup.py
- :emphasize-lines: 5-6
+ :emphasize-lines: 7
:linenos:
#. We can now install our project in development mode:
diff --git a/docs/quick_tutorial/forms/development.ini b/docs/quick_tutorial/forms/development.ini
index 7066668bf..78d7479e7 100644
--- a/docs/quick_tutorial/forms/development.ini
+++ b/docs/quick_tutorial/forms/development.ini
@@ -5,5 +5,5 @@ pyramid.includes =
pyramid_debugtoolbar
[server:main]
-use = egg:pyramid#wsgiref
-port = 6543
+use = egg:waitress#main
+listen = localhost:6543
diff --git a/docs/quick_tutorial/forms/setup.py b/docs/quick_tutorial/forms/setup.py
index 361ade013..5293ef7f0 100644
--- a/docs/quick_tutorial/forms/setup.py
+++ b/docs/quick_tutorial/forms/setup.py
@@ -2,6 +2,7 @@ from setuptools import setup
requires = [
'pyramid',
+ 'waitress',
'pyramid_chameleon',
'deform'
]
diff --git a/docs/quick_tutorial/functional_testing.rst b/docs/quick_tutorial/functional_testing.rst
index 33793578a..518e3d67d 100644
--- a/docs/quick_tutorial/functional_testing.rst
+++ b/docs/quick_tutorial/functional_testing.rst
@@ -14,7 +14,7 @@ Unit tests are a common and popular approach to test-driven development (TDD).
In web applications, though, the templating and entire apparatus of a web site
are important parts of the delivered quality. We'd like a way to test these.
-`WebTest <http://docs.pylonsproject.org/projects/webtest/en/latest/>`_ is a
+`WebTest <https://docs.pylonsproject.org/projects/webtest/en/latest/>`_ is a
Python package that does functional testing. With WebTest you can write tests
which simulate a full HTTP request against a WSGI application, then test the
information in the response. For speed purposes, WebTest skips the
diff --git a/docs/quick_tutorial/functional_testing/development.ini b/docs/quick_tutorial/functional_testing/development.ini
index 17b479011..58d23cff7 100644
--- a/docs/quick_tutorial/functional_testing/development.ini
+++ b/docs/quick_tutorial/functional_testing/development.ini
@@ -4,5 +4,5 @@ pyramid.includes =
pyramid_debugtoolbar
[server:main]
-use = egg:pyramid#wsgiref
-port = 6543
+use = egg:waitress#main
+listen = localhost:6543
diff --git a/docs/quick_tutorial/functional_testing/setup.py b/docs/quick_tutorial/functional_testing/setup.py
index 9997984d3..a93cf6a73 100644
--- a/docs/quick_tutorial/functional_testing/setup.py
+++ b/docs/quick_tutorial/functional_testing/setup.py
@@ -2,6 +2,7 @@ from setuptools import setup
requires = [
'pyramid',
+ 'waitress',
]
setup(name='tutorial',
diff --git a/docs/quick_tutorial/hello_world.rst b/docs/quick_tutorial/hello_world.rst
index 2f2515fcd..94242f1f4 100644
--- a/docs/quick_tutorial/hello_world.rst
+++ b/docs/quick_tutorial/hello_world.rst
@@ -75,7 +75,7 @@ explanation:
"Start here when running from the command line", rather than when this
module is imported.
-#. *Lines 12-14*. Use Pyramid's :term:`configurator` to connect :term:`view`
+#. *Lines 12-14*. Use Pyramid's :term:`configurator` in a :term:`context manager` to connect :term:`view`
code to a particular URL :term:`route`.
#. *Lines 6-8*. Implement the view code that generates the :term:`response`.
diff --git a/docs/quick_tutorial/hello_world/app.py b/docs/quick_tutorial/hello_world/app.py
index 0a95f9ad3..ff0b950d3 100644
--- a/docs/quick_tutorial/hello_world/app.py
+++ b/docs/quick_tutorial/hello_world/app.py
@@ -1,4 +1,4 @@
-from wsgiref.simple_server import make_server
+from waitress import serve
from pyramid.config import Configurator
from pyramid.response import Response
@@ -9,9 +9,8 @@ def hello_world(request):
if __name__ == '__main__':
- config = Configurator()
- config.add_route('hello', '/')
- config.add_view(hello_world, route_name='hello')
- app = config.make_wsgi_app()
- server = make_server('0.0.0.0', 6543, app)
- server.serve_forever()
+ with Configurator() as config:
+ config.add_route('hello', '/')
+ config.add_view(hello_world, route_name='hello')
+ app = config.make_wsgi_app()
+ serve(app, host='0.0.0.0', port=6543)
diff --git a/docs/quick_tutorial/ini.rst b/docs/quick_tutorial/ini.rst
index 96dfc5b5f..e4f30405f 100644
--- a/docs/quick_tutorial/ini.rst
+++ b/docs/quick_tutorial/ini.rst
@@ -89,7 +89,7 @@ application. Processing then proceeds as described in the Pyramid chapter on
- ``pserve`` looks for ``[app:main]`` and finds ``use = egg:tutorial``.
-- The projects's ``setup.py`` has defined an "entry point" (lines 9-12) for the
+- The projects's ``setup.py`` has defined an "entry point" (lines 10-13) for the
project's "main" entry point of ``tutorial:main``.
- The ``tutorial`` package's ``__init__`` has a ``main`` function.
@@ -99,10 +99,14 @@ application. Processing then proceeds as described in the Pyramid chapter on
The ``.ini`` file is also used for two other functions:
-- *Configuring the WSGI server*. ``[server:main]`` wires up the choice of which
- WSGI *server* for your WSGI *application*. In this case, we are using
- ``wsgiref`` bundled in the Python library. It also wires up the *port
- number*: ``port = 6543`` tells ``wsgiref`` to listen on port 6543.
+- *Configuring the WSGI server*. ``[server:main]`` wires up the choice
+ of which WSGI *server* for your WSGI *application*. In this case, we
+ are using ``waitress`` which we specified in
+ ``tutorial/setup.py`` and was installed in the :doc:`requirements` step at the start of this tutorial. It also wires up the *port number*:
+ ``listen = localhost:6543`` tells ``waitress`` to listen on host
+ ``localhost`` at port ``6543``.
+
+ .. note:: Running the command ``$VENV/bin/pip install -e .`` will check for previously installed packages in our virtual environment that are specified in our package's ``setup.py`` file, then install our package in editable mode, installing any requirements that were not previously installed. If a requirement was manually installed previously on the command line or otherwise, in this case Waitress, then ``$VENV/bin/pip install -e .`` will merely check that it is installed and move on.
- *Configuring Python logging*. Pyramid uses Python standard logging, which
needs a number of configuration values. The ``.ini`` serves this function.
diff --git a/docs/quick_tutorial/ini/development.ini b/docs/quick_tutorial/ini/development.ini
index cffbd66c9..5361188a3 100644
--- a/docs/quick_tutorial/ini/development.ini
+++ b/docs/quick_tutorial/ini/development.ini
@@ -2,5 +2,5 @@
use = egg:tutorial
[server:main]
-use = egg:pyramid#wsgiref
-port = 6543
+use = egg:waitress#main
+listen = localhost:6543
diff --git a/docs/quick_tutorial/ini/setup.py b/docs/quick_tutorial/ini/setup.py
index 9997984d3..a93cf6a73 100644
--- a/docs/quick_tutorial/ini/setup.py
+++ b/docs/quick_tutorial/ini/setup.py
@@ -2,6 +2,7 @@ from setuptools import setup
requires = [
'pyramid',
+ 'waitress',
]
setup(name='tutorial',
diff --git a/docs/quick_tutorial/jinja2.rst b/docs/quick_tutorial/jinja2.rst
index 2fc68827b..4faa81fc4 100644
--- a/docs/quick_tutorial/jinja2.rst
+++ b/docs/quick_tutorial/jinja2.rst
@@ -85,7 +85,7 @@ Extra credit
#. We used ``config.include`` which is an imperative configuration to get the
:term:`Configurator` to load ``pyramid_jinja2``'s configuration. What is
- another way could include it into the config?
+ another way we could include it into the config?
.. seealso:: `Jinja2 homepage <http://jinja.pocoo.org/>`_, and
:ref:`pyramid_jinja2 Overview <jinja2:overview>`
diff --git a/docs/quick_tutorial/jinja2/development.ini b/docs/quick_tutorial/jinja2/development.ini
index 7066668bf..78d7479e7 100644
--- a/docs/quick_tutorial/jinja2/development.ini
+++ b/docs/quick_tutorial/jinja2/development.ini
@@ -5,5 +5,5 @@ pyramid.includes =
pyramid_debugtoolbar
[server:main]
-use = egg:pyramid#wsgiref
-port = 6543
+use = egg:waitress#main
+listen = localhost:6543
diff --git a/docs/quick_tutorial/jinja2/setup.py b/docs/quick_tutorial/jinja2/setup.py
index 9997984d3..a93cf6a73 100644
--- a/docs/quick_tutorial/jinja2/setup.py
+++ b/docs/quick_tutorial/jinja2/setup.py
@@ -2,6 +2,7 @@ from setuptools import setup
requires = [
'pyramid',
+ 'waitress',
]
setup(name='tutorial',
diff --git a/docs/quick_tutorial/json/development.ini b/docs/quick_tutorial/json/development.ini
index 7066668bf..78d7479e7 100644
--- a/docs/quick_tutorial/json/development.ini
+++ b/docs/quick_tutorial/json/development.ini
@@ -5,5 +5,5 @@ pyramid.includes =
pyramid_debugtoolbar
[server:main]
-use = egg:pyramid#wsgiref
-port = 6543
+use = egg:waitress#main
+listen = localhost:6543
diff --git a/docs/quick_tutorial/json/setup.py b/docs/quick_tutorial/json/setup.py
index 2221b72e9..aefa352d4 100644
--- a/docs/quick_tutorial/json/setup.py
+++ b/docs/quick_tutorial/json/setup.py
@@ -2,6 +2,7 @@ from setuptools import setup
requires = [
'pyramid',
+ 'waitress',
'pyramid_chameleon'
]
diff --git a/docs/quick_tutorial/logging/development.ini b/docs/quick_tutorial/logging/development.ini
index b869ca5b6..ff470acdb 100644
--- a/docs/quick_tutorial/logging/development.ini
+++ b/docs/quick_tutorial/logging/development.ini
@@ -5,8 +5,8 @@ pyramid.includes =
pyramid_debugtoolbar
[server:main]
-use = egg:pyramid#wsgiref
-port = 6543
+use = egg:waitress#main
+listen = localhost:6543
# Begin logging configuration
diff --git a/docs/quick_tutorial/logging/setup.py b/docs/quick_tutorial/logging/setup.py
index 2221b72e9..aefa352d4 100644
--- a/docs/quick_tutorial/logging/setup.py
+++ b/docs/quick_tutorial/logging/setup.py
@@ -2,6 +2,7 @@ from setuptools import setup
requires = [
'pyramid',
+ 'waitress',
'pyramid_chameleon'
]
diff --git a/docs/quick_tutorial/more_view_classes/development.ini b/docs/quick_tutorial/more_view_classes/development.ini
index 7066668bf..78d7479e7 100644
--- a/docs/quick_tutorial/more_view_classes/development.ini
+++ b/docs/quick_tutorial/more_view_classes/development.ini
@@ -5,5 +5,5 @@ pyramid.includes =
pyramid_debugtoolbar
[server:main]
-use = egg:pyramid#wsgiref
-port = 6543
+use = egg:waitress#main
+listen = localhost:6543
diff --git a/docs/quick_tutorial/more_view_classes/setup.py b/docs/quick_tutorial/more_view_classes/setup.py
index 2221b72e9..aefa352d4 100644
--- a/docs/quick_tutorial/more_view_classes/setup.py
+++ b/docs/quick_tutorial/more_view_classes/setup.py
@@ -2,6 +2,7 @@ from setuptools import setup
requires = [
'pyramid',
+ 'waitress',
'pyramid_chameleon'
]
diff --git a/docs/quick_tutorial/package.rst b/docs/quick_tutorial/package.rst
index 94cb39fc9..66bafcdb9 100644
--- a/docs/quick_tutorial/package.rst
+++ b/docs/quick_tutorial/package.rst
@@ -108,4 +108,4 @@ idea to run a Python module inside a package directly as a script.
.. seealso:: :ref:`Python Packages <python:tut-packages>` and `Working in
"Development Mode"
- <https://packaging.python.org/en/latest/distributing/#working-in-development-mode>`_.
+ <https://packaging.python.org/tutorials/distributing-packages/#working-in-development-mode>`_.
diff --git a/docs/quick_tutorial/package/tutorial/app.py b/docs/quick_tutorial/package/tutorial/app.py
index 210075023..ff0b950d3 100644
--- a/docs/quick_tutorial/package/tutorial/app.py
+++ b/docs/quick_tutorial/package/tutorial/app.py
@@ -1,17 +1,16 @@
-from wsgiref.simple_server import make_server
+from waitress import serve
from pyramid.config import Configurator
from pyramid.response import Response
def hello_world(request):
- print ('Incoming request')
+ print('Incoming request')
return Response('<body><h1>Hello World!</h1></body>')
if __name__ == '__main__':
- config = Configurator()
- config.add_route('hello', '/')
- config.add_view(hello_world, route_name='hello')
- app = config.make_wsgi_app()
- server = make_server('0.0.0.0', 6543, app)
- server.serve_forever() \ No newline at end of file
+ with Configurator() as config:
+ config.add_route('hello', '/')
+ config.add_view(hello_world, route_name='hello')
+ app = config.make_wsgi_app()
+ serve(app, host='0.0.0.0', port=6543)
diff --git a/docs/quick_tutorial/request_response/development.ini b/docs/quick_tutorial/request_response/development.ini
index 7066668bf..78d7479e7 100644
--- a/docs/quick_tutorial/request_response/development.ini
+++ b/docs/quick_tutorial/request_response/development.ini
@@ -5,5 +5,5 @@ pyramid.includes =
pyramid_debugtoolbar
[server:main]
-use = egg:pyramid#wsgiref
-port = 6543
+use = egg:waitress#main
+listen = localhost:6543
diff --git a/docs/quick_tutorial/request_response/setup.py b/docs/quick_tutorial/request_response/setup.py
index 9997984d3..a93cf6a73 100644
--- a/docs/quick_tutorial/request_response/setup.py
+++ b/docs/quick_tutorial/request_response/setup.py
@@ -2,6 +2,7 @@ from setuptools import setup
requires = [
'pyramid',
+ 'waitress',
]
setup(name='tutorial',
diff --git a/docs/quick_tutorial/requirements.rst b/docs/quick_tutorial/requirements.rst
index 70e68514b..a65cfe6d2 100644
--- a/docs/quick_tutorial/requirements.rst
+++ b/docs/quick_tutorial/requirements.rst
@@ -189,17 +189,18 @@ Install Pyramid
---------------
We have our Python standard prerequisites out of the way. The Pyramid
-part is pretty easy.
+part is pretty easy. We'll also install a WSGI server, Waitress.
.. parsed-literal::
# Mac and Linux
- $ $VENV/bin/pip install "pyramid==\ |release|\ "
+ $ $VENV/bin/pip install "pyramid==\ |release|\ " waitress
# Windows
- c:\\> %VENV%\\Scripts\\pip install "pyramid==\ |release|\ "
+ c:\\> %VENV%\\Scripts\\pip install "pyramid==\ |release|\ " waitress
-Our Python virtual environment now has the Pyramid software available.
+Our Python virtual environment now has the Pyramid software available
+as well as the ``waitress`` package.
You can optionally install some of the extra Python packages used in this
tutorial.
diff --git a/docs/quick_tutorial/retail_forms/development.ini b/docs/quick_tutorial/retail_forms/development.ini
index 7066668bf..78d7479e7 100644
--- a/docs/quick_tutorial/retail_forms/development.ini
+++ b/docs/quick_tutorial/retail_forms/development.ini
@@ -5,5 +5,5 @@ pyramid.includes =
pyramid_debugtoolbar
[server:main]
-use = egg:pyramid#wsgiref
-port = 6543
+use = egg:waitress#main
+listen = localhost:6543
diff --git a/docs/quick_tutorial/retail_forms/setup.py b/docs/quick_tutorial/retail_forms/setup.py
index 361ade013..5293ef7f0 100644
--- a/docs/quick_tutorial/retail_forms/setup.py
+++ b/docs/quick_tutorial/retail_forms/setup.py
@@ -2,6 +2,7 @@ from setuptools import setup
requires = [
'pyramid',
+ 'waitress',
'pyramid_chameleon',
'deform'
]
diff --git a/docs/quick_tutorial/routing.rst b/docs/quick_tutorial/routing.rst
index d88adfa1e..adbe76a62 100644
--- a/docs/quick_tutorial/routing.rst
+++ b/docs/quick_tutorial/routing.rst
@@ -121,4 +121,4 @@ Extra credit
result that you expected?
.. seealso:: `Weird Stuff You Can Do With URL Dispatch
- <http://www.plope.com/weird_pyramid_urldispatch>`_
+ <https://web.archive.org/web/20170131192830/http://www.plope.com/weird_pyramid_urldispatch>`_
diff --git a/docs/quick_tutorial/routing/development.ini b/docs/quick_tutorial/routing/development.ini
index 7066668bf..78d7479e7 100644
--- a/docs/quick_tutorial/routing/development.ini
+++ b/docs/quick_tutorial/routing/development.ini
@@ -5,5 +5,5 @@ pyramid.includes =
pyramid_debugtoolbar
[server:main]
-use = egg:pyramid#wsgiref
-port = 6543
+use = egg:waitress#main
+listen = localhost:6543
diff --git a/docs/quick_tutorial/routing/setup.py b/docs/quick_tutorial/routing/setup.py
index 2221b72e9..aefa352d4 100644
--- a/docs/quick_tutorial/routing/setup.py
+++ b/docs/quick_tutorial/routing/setup.py
@@ -2,6 +2,7 @@ from setuptools import setup
requires = [
'pyramid',
+ 'waitress',
'pyramid_chameleon'
]
diff --git a/docs/quick_tutorial/sessions/development.ini b/docs/quick_tutorial/sessions/development.ini
index 7066668bf..78d7479e7 100644
--- a/docs/quick_tutorial/sessions/development.ini
+++ b/docs/quick_tutorial/sessions/development.ini
@@ -5,5 +5,5 @@ pyramid.includes =
pyramid_debugtoolbar
[server:main]
-use = egg:pyramid#wsgiref
-port = 6543
+use = egg:waitress#main
+listen = localhost:6543
diff --git a/docs/quick_tutorial/sessions/setup.py b/docs/quick_tutorial/sessions/setup.py
index 2221b72e9..aefa352d4 100644
--- a/docs/quick_tutorial/sessions/setup.py
+++ b/docs/quick_tutorial/sessions/setup.py
@@ -2,6 +2,7 @@ from setuptools import setup
requires = [
'pyramid',
+ 'waitress',
'pyramid_chameleon'
]
diff --git a/docs/quick_tutorial/static_assets.rst b/docs/quick_tutorial/static_assets.rst
index b8482492d..81a01061a 100644
--- a/docs/quick_tutorial/static_assets.rst
+++ b/docs/quick_tutorial/static_assets.rst
@@ -43,13 +43,20 @@ Steps
.. literalinclude:: static_assets/tutorial/static/app.css
:language: css
-#. Make sure we haven't broken any existing code by running the tests:
+#. We add a functional test that asserts that the newly added static file is delivered:
+
+ .. literalinclude:: static_assets/tutorial/tests.py
+ :language: python
+ :pyobject: TutorialFunctionalTests.test_css
+ :lineno-match:
+
+#. Now run the tests:
.. code-block:: bash
$ $VENV/bin/py.test tutorial/tests.py -q
....
- 4 passed in 0.50 seconds
+ 5 passed in 0.50 seconds
#. Run your Pyramid application with:
diff --git a/docs/quick_tutorial/static_assets/development.ini b/docs/quick_tutorial/static_assets/development.ini
index 7066668bf..78d7479e7 100644
--- a/docs/quick_tutorial/static_assets/development.ini
+++ b/docs/quick_tutorial/static_assets/development.ini
@@ -5,5 +5,5 @@ pyramid.includes =
pyramid_debugtoolbar
[server:main]
-use = egg:pyramid#wsgiref
-port = 6543
+use = egg:waitress#main
+listen = localhost:6543
diff --git a/docs/quick_tutorial/static_assets/setup.py b/docs/quick_tutorial/static_assets/setup.py
index 2221b72e9..aefa352d4 100644
--- a/docs/quick_tutorial/static_assets/setup.py
+++ b/docs/quick_tutorial/static_assets/setup.py
@@ -2,6 +2,7 @@ from setuptools import setup
requires = [
'pyramid',
+ 'waitress',
'pyramid_chameleon'
]
diff --git a/docs/quick_tutorial/static_assets/tutorial/tests.py b/docs/quick_tutorial/static_assets/tutorial/tests.py
index 4381235ec..b560ddf82 100644
--- a/docs/quick_tutorial/static_assets/tutorial/tests.py
+++ b/docs/quick_tutorial/static_assets/tutorial/tests.py
@@ -42,3 +42,7 @@ class TutorialFunctionalTests(unittest.TestCase):
def test_hello(self):
res = self.testapp.get('/howdy', status=200)
self.assertIn(b'<h1>Hi Hello View', res.body)
+
+ def test_css(self):
+ res = self.testapp.get('/static/app.css', status=200)
+ self.assertIn(b'body', res.body)
diff --git a/docs/quick_tutorial/templating/development.ini b/docs/quick_tutorial/templating/development.ini
index 7066668bf..78d7479e7 100644
--- a/docs/quick_tutorial/templating/development.ini
+++ b/docs/quick_tutorial/templating/development.ini
@@ -5,5 +5,5 @@ pyramid.includes =
pyramid_debugtoolbar
[server:main]
-use = egg:pyramid#wsgiref
-port = 6543
+use = egg:waitress#main
+listen = localhost:6543
diff --git a/docs/quick_tutorial/templating/setup.py b/docs/quick_tutorial/templating/setup.py
index 0b71b73e6..d1910178e 100644
--- a/docs/quick_tutorial/templating/setup.py
+++ b/docs/quick_tutorial/templating/setup.py
@@ -2,6 +2,7 @@ from setuptools import setup
requires = [
'pyramid',
+ 'waitress',
'pyramid_chameleon',
]
diff --git a/docs/quick_tutorial/unit_testing.rst b/docs/quick_tutorial/unit_testing.rst
index 7c85d5289..002c62fde 100644
--- a/docs/quick_tutorial/unit_testing.rst
+++ b/docs/quick_tutorial/unit_testing.rst
@@ -29,7 +29,7 @@ broken the code. As you're writing your code, you might find this more
convenient than changing to your browser constantly and clicking reload.
We'll also leave discussion of `pytest-cov
-<http://pytest-cov.readthedocs.org/en/latest/>`_ for another section.
+<http://pytest-cov.readthedocs.io/en/latest/>`_ for another section.
Objectives
diff --git a/docs/quick_tutorial/unit_testing/development.ini b/docs/quick_tutorial/unit_testing/development.ini
index 17b479011..58d23cff7 100644
--- a/docs/quick_tutorial/unit_testing/development.ini
+++ b/docs/quick_tutorial/unit_testing/development.ini
@@ -4,5 +4,5 @@ pyramid.includes =
pyramid_debugtoolbar
[server:main]
-use = egg:pyramid#wsgiref
-port = 6543
+use = egg:waitress#main
+listen = localhost:6543
diff --git a/docs/quick_tutorial/unit_testing/setup.py b/docs/quick_tutorial/unit_testing/setup.py
index 9997984d3..a93cf6a73 100644
--- a/docs/quick_tutorial/unit_testing/setup.py
+++ b/docs/quick_tutorial/unit_testing/setup.py
@@ -2,6 +2,7 @@ from setuptools import setup
requires = [
'pyramid',
+ 'waitress',
]
setup(name='tutorial',
diff --git a/docs/quick_tutorial/view_classes.rst b/docs/quick_tutorial/view_classes.rst
index 05d97a9b1..49cdcddcc 100644
--- a/docs/quick_tutorial/view_classes.rst
+++ b/docs/quick_tutorial/view_classes.rst
@@ -12,7 +12,7 @@ Background
==========
So far our views have been simple, free-standing functions. Many times your
-views are related to one another. They may be different ways to look at or work
+views are related to one another. They may consist of different ways to look at or work
on the same data, or be a REST API that handles multiple operations. Grouping
these views together as a :ref:`view class <class_as_view>` makes sense:
diff --git a/docs/quick_tutorial/view_classes/development.ini b/docs/quick_tutorial/view_classes/development.ini
index 7066668bf..78d7479e7 100644
--- a/docs/quick_tutorial/view_classes/development.ini
+++ b/docs/quick_tutorial/view_classes/development.ini
@@ -5,5 +5,5 @@ pyramid.includes =
pyramid_debugtoolbar
[server:main]
-use = egg:pyramid#wsgiref
-port = 6543
+use = egg:waitress#main
+listen = localhost:6543
diff --git a/docs/quick_tutorial/view_classes/setup.py b/docs/quick_tutorial/view_classes/setup.py
index 2221b72e9..aefa352d4 100644
--- a/docs/quick_tutorial/view_classes/setup.py
+++ b/docs/quick_tutorial/view_classes/setup.py
@@ -2,6 +2,7 @@ from setuptools import setup
requires = [
'pyramid',
+ 'waitress',
'pyramid_chameleon'
]
diff --git a/docs/quick_tutorial/views/development.ini b/docs/quick_tutorial/views/development.ini
index 17b479011..58d23cff7 100644
--- a/docs/quick_tutorial/views/development.ini
+++ b/docs/quick_tutorial/views/development.ini
@@ -4,5 +4,5 @@ pyramid.includes =
pyramid_debugtoolbar
[server:main]
-use = egg:pyramid#wsgiref
-port = 6543
+use = egg:waitress#main
+listen = localhost:6543
diff --git a/docs/quick_tutorial/views/setup.py b/docs/quick_tutorial/views/setup.py
index 9997984d3..a93cf6a73 100644
--- a/docs/quick_tutorial/views/setup.py
+++ b/docs/quick_tutorial/views/setup.py
@@ -2,6 +2,7 @@ from setuptools import setup
requires = [
'pyramid',
+ 'waitress',
]
setup(name='tutorial',