summaryrefslogtreecommitdiff
path: root/docs/narr
diff options
context:
space:
mode:
Diffstat (limited to 'docs/narr')
-rw-r--r--docs/narr/advconfig.rst20
-rw-r--r--docs/narr/configuration.rst11
-rw-r--r--docs/narr/firstapp.rst24
-rw-r--r--docs/narr/hooks.rst5
-rw-r--r--docs/narr/install.rst11
-rw-r--r--docs/narr/paste.rst2
-rw-r--r--docs/narr/project.rst9
7 files changed, 44 insertions, 38 deletions
diff --git a/docs/narr/advconfig.rst b/docs/narr/advconfig.rst
index 3a7bf2805..5f2175d2a 100644
--- a/docs/narr/advconfig.rst
+++ b/docs/narr/advconfig.rst
@@ -27,7 +27,7 @@ configured imperatively:
.. code-block:: python
:linenos:
- from paste.httpserver import serve
+ from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from pyramid.response import Response
@@ -38,7 +38,8 @@ configured imperatively:
config = Configurator()
config.add_view(hello_world)
app = config.make_wsgi_app()
- serve(app, host='0.0.0.0')
+ server = make_server('0.0.0.0', 8080, app)
+ server.serve_forever()
When you start this application, all will be OK. However, what happens if we
try to add another view to the configuration with the same set of
@@ -47,7 +48,7 @@ try to add another view to the configuration with the same set of
.. code-block:: python
:linenos:
- from paste.httpserver import serve
+ from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from pyramid.response import Response
@@ -66,7 +67,8 @@ try to add another view to the configuration with the same set of
config.add_view(goodbye_world, name='hello')
app = config.make_wsgi_app()
- serve(app, host='0.0.0.0')
+ server = make_server('0.0.0.0', 8080, app)
+ server.serve_forever()
The application now has two conflicting view configuration statements. When
we try to start it again, it won't start. Instead, we'll receive a traceback
@@ -170,7 +172,7 @@ application that generates conflicts:
.. code-block:: python
:linenos:
- from paste.httpserver import serve
+ from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from pyramid.response import Response
@@ -189,7 +191,8 @@ application that generates conflicts:
config.add_view(goodbye_world, name='hello')
app = config.make_wsgi_app()
- serve(app, host='0.0.0.0')
+ server = make_server('0.0.0.0', 8080, app)
+ server.serve_forever()
We can prevent the two ``add_view`` calls from conflicting by issuing a call
to :meth:`~pyramid.config.Configurator.commit` between them:
@@ -197,7 +200,7 @@ to :meth:`~pyramid.config.Configurator.commit` between them:
.. code-block:: python
:linenos:
- from paste.httpserver import serve
+ from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from pyramid.response import Response
@@ -218,7 +221,8 @@ to :meth:`~pyramid.config.Configurator.commit` between them:
config.add_view(goodbye_world, name='hello')
app = config.make_wsgi_app()
- serve(app, host='0.0.0.0')
+ server = make_server('0.0.0.0', 8080, app)
+ server.serve_forever()
In the above example we've issued a call to
:meth:`~pyramid.config.Configurator.commit` between the two ``add_view``
diff --git a/docs/narr/configuration.rst b/docs/narr/configuration.rst
index 597d48b09..37122e382 100644
--- a/docs/narr/configuration.rst
+++ b/docs/narr/configuration.rst
@@ -36,7 +36,7 @@ applications, configured imperatively:
.. code-block:: python
:linenos:
- from paste.httpserver import serve
+ from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from pyramid.response import Response
@@ -46,8 +46,8 @@ applications, configured imperatively:
if __name__ == '__main__':
config = Configurator()
config.add_view(hello_world)
- app = config.make_wsgi_app()
- serve(app, host='0.0.0.0')
+ server = make_server('0.0.0.0', 8080, app)
+ server.serve_forever()
We won't talk much about what this application does yet. Just note that the
"configuration' statements take place underneath the ``if __name__ ==
@@ -105,7 +105,7 @@ in a package and its subpackages. For example:
.. code-block:: python
:linenos:
- from paste.httpserver import serve
+ from wsgiref.simple_server import make_server
from pyramid.response import Response
from pyramid.view import view_config
@@ -118,7 +118,8 @@ in a package and its subpackages. For example:
config = Configurator()
config.scan()
app = config.make_wsgi_app()
- serve(app, host='0.0.0.0')
+ server = make_server('0.0.0.0', 8080, app)
+ server.serve_forever()
The scanning machinery imports each module and subpackage in a package or
module recursively, looking for special attributes attached to objects
diff --git a/docs/narr/firstapp.rst b/docs/narr/firstapp.rst
index c082f616b..922b0ea82 100644
--- a/docs/narr/firstapp.rst
+++ b/docs/narr/firstapp.rst
@@ -54,9 +54,8 @@ The script imports the :class:`~pyramid.config.Configurator` class from the
Like many other Python web frameworks, :app:`Pyramid` uses the :term:`WSGI`
protocol to connect an application and a web server together. The
-:mod:`paste.httpserver` server is used in this example as a WSGI server for
-convenience, as the ``paste`` package is a dependency of :app:`Pyramid`
-itself.
+:mod:`wsgiref` server is used in this example as a WSGI server for
+convenience, as it is shipped within the Python standard library.
The script also imports the :class:`pyramid.response.Response` class for
later use. An instance of this class will be used to create a web response.
@@ -205,14 +204,17 @@ WSGI Application Serving
:lines: 13
Finally, we actually serve the application to requestors by starting up a
-WSGI server. We happen to use the :func:`paste.httpserver.serve` WSGI server
-runner, passing it the ``app`` object (a :term:`router`) as the application
-we wish to serve. We also pass in an argument ``host='0.0.0.0'``, meaning
-"listen on all TCP interfaces." By default, the HTTP server listens
-only on the ``127.0.0.1`` interface, which is problematic if you're running
-the server on a remote system and you wish to access it with a web browser
-from a local system. We don't specify a TCP port number to listen on; this
-means we want to use the default TCP port, which is 8080.
+WSGI server. We happen to use the :mod:`wsgiref` ``make_server`` server
+maker for this purpose. We pass in as the first argument ``'0.0.0.0'``,
+which means "listen on all TCP interfaces." By default, the HTTP server
+listens only on the ``127.0.0.1`` interface, which is problematic if you're
+running the server on a remote system and you wish to access it with a web
+browser from a local system. We also specify a TCP port number to listen on,
+which is 8080, passing it as the second argument. The final argument ios ,
+passing it the ``app`` object (a :term:`router`), which is the the
+application we wish to serve. Finally, we call the server's
+``serve_forever`` method, which starts the main loop in which it will wait
+for requests from the outside world.
When this line is invoked, it causes the server to start listening on TCP
port 8080. The server will serve requests forever, or at least until we stop
diff --git a/docs/narr/hooks.rst b/docs/narr/hooks.rst
index a1ed6c7ff..fd6544416 100644
--- a/docs/narr/hooks.rst
+++ b/docs/narr/hooks.rst
@@ -812,7 +812,7 @@ performed, enabling you to set up the utility in advance:
.. code-block:: python
:linenos:
- from paste.httpserver import serve
+ from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from mypackage.interfaces import IMyUtility
@@ -831,7 +831,8 @@ performed, enabling you to set up the utility in advance:
config.registry.registerUtility(UtilityImplementation())
config.scan()
app = config.make_wsgi_app()
- serve(app, host='0.0.0.0')
+ server = make_server('0.0.0.0', 8080, app)
+ server.serve_forever()
For full details, please read the `Venusian documentation
<http://docs.repoze.org/venusian>`_.
diff --git a/docs/narr/install.rst b/docs/narr/install.rst
index 3de4d6e27..172cfd6d3 100644
--- a/docs/narr/install.rst
+++ b/docs/narr/install.rst
@@ -20,7 +20,7 @@ run :app:`Pyramid`.
:app:`Pyramid` is known to run on all popular UNIX-like systems such as
Linux, MacOS X, and FreeBSD as well as on Windows platforms. It is also
-known to run on Google's App Engine, and :term:`PyPy` (1.6+).
+known to run on :term:`PyPy` (1.6+).
:app:`Pyramid` installation does not require the compilation of any
C code, so you need only a Python interpreter that meets the
@@ -315,15 +315,6 @@ Installing :app:`Pyramid` on a Windows System
c:\env> Scripts\easy_install pyramid
-.. index::
- single: installing on Google App Engine
-
-Installing :app:`Pyramid` on Google App Engine
--------------------------------------------------
-
-:ref:`appengine_tutorial` documents the steps required to install a
-:app:`Pyramid` application on Google App Engine.
-
What Gets Installed
-------------------
diff --git a/docs/narr/paste.rst b/docs/narr/paste.rst
index cf8f96c8a..86b047aec 100644
--- a/docs/narr/paste.rst
+++ b/docs/narr/paste.rst
@@ -17,7 +17,7 @@ a Pyramid application that doesn't use PasteDeploy in
:ref:`firstapp_chapter`. However, all Pyramid scaffolds render PasteDeploy
configuration files, to provide new developers with a standardized way of
setting deployment values, and to provide new users with a standardized way
-of starting, stopping, and debugging an application.
+of starting, stopping, and debugging an application.
This chapter is not a replacement for documentation about PasteDeploy; it
only contextualizes the use of PasteDeploy within Pyramid. For detailed
diff --git a/docs/narr/project.rst b/docs/narr/project.rst
index af8714573..0c12d97e6 100644
--- a/docs/narr/project.rst
+++ b/docs/narr/project.rst
@@ -283,7 +283,7 @@ For example, on UNIX:
$ ../bin/pserve development.ini --reload
Starting subprocess with file monitor
Starting server in PID 16601.
- serving on 0.0.0.0:6543 view at http://127.0.0.1:6543
+ Starting HTTP server on http://0.0.0.0:6543
For more detailed information about the startup process, see
:ref:`startup_chapter`. For more information about environment variables and
@@ -909,6 +909,13 @@ one of the following.
compatible. You'll need to ``easy_install CherryPy`` into your Pyramid
virtualenv for this server to work.
+The servers described above are typically both faster and more secure than
+the default WSGI server used by Pyramid. Pyramid does not depend on either
+because Paste doesn't run on Python 3 (and Pyramid must) and the CherryPy
+server is not distributed separately from the CherryPy web framework (and it
+would be an awkward dependency to have a web framework rely on another web
+framework for just its server component).
+
``pserve`` is by no means the only way to start up and serve a :app:`Pyramid`
application. As we saw in :ref:`firstapp_chapter`, ``pserve`` needn't be
invoked at all to run a :app:`Pyramid` application. The use of ``pserve`` to