| | |
| | | |
| | | .. literalinclude:: helloworld.py |
| | | :linenos: |
| | | :lines: 8-13 |
| | | :lines: 9-15 |
| | | |
| | | Let's break this down piece-by-piece. |
| | | |
| | |
| | | |
| | | .. literalinclude:: helloworld.py |
| | | :linenos: |
| | | :lines: 8-9 |
| | | :lines: 9-10 |
| | | |
| | | The ``if __name__ == '__main__':`` line in the code sample above represents a |
| | | Python idiom: the code inside this if clause is not invoked unless the script |
| | |
| | | .. ignore-next-block |
| | | .. literalinclude:: helloworld.py |
| | | :linenos: |
| | | :lines: 10-11 |
| | | :lines: 11-12 |
| | | |
| | | First line above calls the :meth:`pyramid.config.Configurator.add_route` |
| | | method, which registers a :term:`route` to match any URL path that begins |
| | |
| | | .. ignore-next-block |
| | | .. literalinclude:: helloworld.py |
| | | :linenos: |
| | | :lines: 12 |
| | | :lines: 13 |
| | | |
| | | After configuring views and ending configuration, the script creates a WSGI |
| | | *application* via the :meth:`pyramid.config.Configurator.make_wsgi_app` |
| | |
| | | .. ignore-next-block |
| | | .. literalinclude:: helloworld.py |
| | | :linenos: |
| | | :lines: 13 |
| | | :lines: 14 |
| | | |
| | | Finally, we actually serve the application to requestors by starting up a |
| | | WSGI server. We happen to use the :mod:`wsgiref` ``make_server`` server |