summaryrefslogtreecommitdiff
path: root/docs/narr/advconfig.rst
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2012-01-10 14:45:12 -0500
committerChris McDonough <chrism@plope.com>2012-01-10 14:45:12 -0500
commit26484029f9d4d591e9541547f6d5e381ce3a0be2 (patch)
treeaba3132e660b320a6734adb0d93a3b6bbdcf5877 /docs/narr/advconfig.rst
parenta21278872884809cfec7d5de8c64518c404f2b02 (diff)
parentcf3a11e990adda800e284effb006f1c28335da4d (diff)
downloadpyramid-26484029f9d4d591e9541547f6d5e381ce3a0be2.tar.gz
pyramid-26484029f9d4d591e9541547f6d5e381ce3a0be2.tar.bz2
pyramid-26484029f9d4d591e9541547f6d5e381ce3a0be2.zip
Merge branch '1.3-branch'
Diffstat (limited to 'docs/narr/advconfig.rst')
-rw-r--r--docs/narr/advconfig.rst20
1 files changed, 12 insertions, 8 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``