summaryrefslogtreecommitdiff
path: root/docs/narr/firstapp.rst
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2012-01-19 03:24:04 -0500
committerChris McDonough <chrism@plope.com>2012-01-19 03:24:04 -0500
commit077f3d1d0b28d9f565cc07a3ad11f4a8bb359054 (patch)
tree09ac1c9fb803fc89a557eb7283452e526614232e /docs/narr/firstapp.rst
parent4ef8a99d3260d99fa5522a0d26f1e7c1487c0265 (diff)
parent520676451b8b89177ad95cfcaa3f90484f5a6a18 (diff)
downloadpyramid-077f3d1d0b28d9f565cc07a3ad11f4a8bb359054.tar.gz
pyramid-077f3d1d0b28d9f565cc07a3ad11f4a8bb359054.tar.bz2
pyramid-077f3d1d0b28d9f565cc07a3ad11f4a8bb359054.zip
Merge branch '1.3-branch'
Diffstat (limited to 'docs/narr/firstapp.rst')
-rw-r--r--docs/narr/firstapp.rst39
1 files changed, 27 insertions, 12 deletions
diff --git a/docs/narr/firstapp.rst b/docs/narr/firstapp.rst
index 922b0ea82..1ca188d7e 100644
--- a/docs/narr/firstapp.rst
+++ b/docs/narr/firstapp.rst
@@ -22,17 +22,33 @@ Here's one of the very simplest :app:`Pyramid` applications:
When this code is inserted into a Python script named ``helloworld.py`` and
executed by a Python interpreter which has the :app:`Pyramid` software
-installed, an HTTP server is started on TCP port 8080:
+installed, an HTTP server is started on TCP port 8080.
+
+On UNIX:
+
+.. code-block:: text
+
+ $ /path/to/your/virtualenv/bin/python helloworld.py
+
+On Windows:
.. code-block:: text
- $ python helloworld.py
- serving on 0.0.0.0:8080 view at http://127.0.0.1:8080
+ C:\> \path\to\your\virtualenv\Scripts\python.exe helloworld.py
+This command will not return and nothing will be printed to the console.
When port 8080 is visited by a browser on the URL ``/hello/world``, the
-server will simply serve up the text "Hello world!"
+server will simply serve up the text "Hello world!". If your application is
+running on your local system, using ``http://localhost:8080/hello/world``
+in a browser will show this result.
+
+Each time you visit a URL served by the application in a browser, a logging
+line will be emitted to the console displaying the hostname, the date, the
+request method and path, and some additional information. This output is
+done by the wsgiref server we've used to serve this application. It logs an
+"access log" in Apache combined logging format to the console.
-Press ``Ctrl-C`` to stop the application.
+Press ``Ctrl-C`` (or ``Ctrl-Break`` on Windows) to stop the application.
Now that we have a rudimentary understanding of what the application does,
let's examine it piece-by-piece.
@@ -210,16 +226,15 @@ 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.
+which is 8080, passing it as the second argument. The final argument is 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
-it by killing the process which runs it (usually by pressing ``Ctrl-C`` in
-the terminal we used to start it).
+it by killing the process which runs it (usually by pressing ``Ctrl-C``
+or ``Ctrl-Break`` in the terminal we used to start it).
Conclusion
~~~~~~~~~~