Merge pull request #3186 from stevepiercy/1.9-branch
Feature/gh#2926 quick tutorial wsgiref to waitress
| | |
| | | |
| | | .. literalinclude:: authentication/setup.py |
| | | :language: python |
| | | :emphasize-lines: 5-6 |
| | | :emphasize-lines: 7 |
| | | :linenos: |
| | | |
| | | #. We can now install our project in development mode: |
| | |
| | | tutorial.secret = 98zd |
| | | |
| | | [server:main] |
| | | use = egg:pyramid#wsgiref |
| | | port = 6543 |
| | | use = egg:waitress#main |
| | | listen = localhost:6543 |
| | |
| | | |
| | | requires = [ |
| | | 'pyramid', |
| | | 'waitress', |
| | | 'pyramid_chameleon', |
| | | 'bcrypt' |
| | | ] |
| | |
| | | tutorial.secret = 98zd |
| | | |
| | | [server:main] |
| | | use = egg:pyramid#wsgiref |
| | | port = 6543 |
| | | use = egg:waitress#main |
| | | listen = localhost:6543 |
| | |
| | | |
| | | requires = [ |
| | | 'pyramid', |
| | | 'waitress', |
| | | 'pyramid_chameleon', |
| | | 'bcrypt' |
| | | ] |
| | |
| | | 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 |
| | | |
| | |
| | | |
| | | requires = [ |
| | | 'pyramid', |
| | | 'waitress', |
| | | 'pyramid_chameleon', |
| | | 'deform', |
| | | 'sqlalchemy', |
| | |
| | | pyramid_debugtoolbar |
| | | |
| | | [server:main] |
| | | use = egg:pyramid#wsgiref |
| | | port = 6543 |
| | | use = egg:waitress#main |
| | | listen = localhost:6543 |
| | |
| | | |
| | | requires = [ |
| | | 'pyramid', |
| | | 'waitress', |
| | | ] |
| | | |
| | | setup(name='tutorial', |
| | |
| | | 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: |
| | |
| | | pyramid_debugtoolbar |
| | | |
| | | [server:main] |
| | | use = egg:pyramid#wsgiref |
| | | port = 6543 |
| | | use = egg:waitress#main |
| | | listen = localhost:6543 |
| | |
| | | |
| | | requires = [ |
| | | 'pyramid', |
| | | 'waitress', |
| | | 'pyramid_chameleon', |
| | | 'deform' |
| | | ] |
| | |
| | | pyramid_debugtoolbar |
| | | |
| | | [server:main] |
| | | use = egg:pyramid#wsgiref |
| | | port = 6543 |
| | | use = egg:waitress#main |
| | | listen = localhost:6543 |
| | |
| | | |
| | | requires = [ |
| | | 'pyramid', |
| | | 'waitress', |
| | | ] |
| | | |
| | | setup(name='tutorial', |
| | |
| | | from wsgiref.simple_server import make_server |
| | | from waitress import serve |
| | | from pyramid.config import Configurator |
| | | from pyramid.response import Response |
| | | |
| | |
| | | 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() |
| | | serve(app, host='0.0.0.0', port=6543) |
| | |
| | | |
| | | - ``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. |
| | |
| | | |
| | | 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 was specified in |
| | | ``tutorial/setup.py``. It also wires up the *port number*: |
| | | ``listen = localhost:6543`` tells ``waitress`` to listen on host |
| | | ``localhost`` at port ``6543``. |
| | | |
| | | - *Configuring Python logging*. Pyramid uses Python standard logging, which |
| | | needs a number of configuration values. The ``.ini`` serves this function. |
| | |
| | | use = egg:tutorial |
| | | |
| | | [server:main] |
| | | use = egg:pyramid#wsgiref |
| | | port = 6543 |
| | | use = egg:waitress#main |
| | | listen = localhost:6543 |
| | |
| | | |
| | | requires = [ |
| | | 'pyramid', |
| | | 'waitress', |
| | | ] |
| | | |
| | | setup(name='tutorial', |
| | |
| | | pyramid_debugtoolbar |
| | | |
| | | [server:main] |
| | | use = egg:pyramid#wsgiref |
| | | port = 6543 |
| | | use = egg:waitress#main |
| | | listen = localhost:6543 |
| | |
| | | |
| | | requires = [ |
| | | 'pyramid', |
| | | 'waitress', |
| | | ] |
| | | |
| | | setup(name='tutorial', |
| | |
| | | pyramid_debugtoolbar |
| | | |
| | | [server:main] |
| | | use = egg:pyramid#wsgiref |
| | | port = 6543 |
| | | use = egg:waitress#main |
| | | listen = localhost:6543 |
| | |
| | | |
| | | requires = [ |
| | | 'pyramid', |
| | | 'waitress', |
| | | 'pyramid_chameleon' |
| | | ] |
| | | |
| | |
| | | pyramid_debugtoolbar |
| | | |
| | | [server:main] |
| | | use = egg:pyramid#wsgiref |
| | | port = 6543 |
| | | use = egg:waitress#main |
| | | listen = localhost:6543 |
| | | |
| | | # Begin logging configuration |
| | | |
| | |
| | | |
| | | requires = [ |
| | | 'pyramid', |
| | | 'waitress', |
| | | 'pyramid_chameleon' |
| | | ] |
| | | |
| | |
| | | pyramid_debugtoolbar |
| | | |
| | | [server:main] |
| | | use = egg:pyramid#wsgiref |
| | | port = 6543 |
| | | use = egg:waitress#main |
| | | listen = localhost:6543 |
| | |
| | | |
| | | requires = [ |
| | | 'pyramid', |
| | | 'waitress', |
| | | 'pyramid_chameleon' |
| | | ] |
| | | |
| | |
| | | from wsgiref.simple_server import make_server |
| | | from waitress import serve |
| | | from pyramid.config import Configurator |
| | | from pyramid.response import Response |
| | | |
| | |
| | | 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() |
| | | serve(app, host='0.0.0.0', port=6543) |
| | |
| | | pyramid_debugtoolbar |
| | | |
| | | [server:main] |
| | | use = egg:pyramid#wsgiref |
| | | port = 6543 |
| | | use = egg:waitress#main |
| | | listen = localhost:6543 |
| | |
| | | |
| | | requires = [ |
| | | 'pyramid', |
| | | 'waitress', |
| | | ] |
| | | |
| | | setup(name='tutorial', |
| | |
| | | --------------- |
| | | |
| | | 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. |
| | |
| | | pyramid_debugtoolbar |
| | | |
| | | [server:main] |
| | | use = egg:pyramid#wsgiref |
| | | port = 6543 |
| | | use = egg:waitress#main |
| | | listen = localhost:6543 |
| | |
| | | |
| | | requires = [ |
| | | 'pyramid', |
| | | 'waitress', |
| | | 'pyramid_chameleon', |
| | | 'deform' |
| | | ] |
| | |
| | | pyramid_debugtoolbar |
| | | |
| | | [server:main] |
| | | use = egg:pyramid#wsgiref |
| | | port = 6543 |
| | | use = egg:waitress#main |
| | | listen = localhost:6543 |
| | |
| | | |
| | | requires = [ |
| | | 'pyramid', |
| | | 'waitress', |
| | | 'pyramid_chameleon' |
| | | ] |
| | | |
| | |
| | | pyramid_debugtoolbar |
| | | |
| | | [server:main] |
| | | use = egg:pyramid#wsgiref |
| | | port = 6543 |
| | | use = egg:waitress#main |
| | | listen = localhost:6543 |
| | |
| | | |
| | | requires = [ |
| | | 'pyramid', |
| | | 'waitress', |
| | | 'pyramid_chameleon' |
| | | ] |
| | | |
| | |
| | | pyramid_debugtoolbar |
| | | |
| | | [server:main] |
| | | use = egg:pyramid#wsgiref |
| | | port = 6543 |
| | | use = egg:waitress#main |
| | | listen = localhost:6543 |
| | |
| | | |
| | | requires = [ |
| | | 'pyramid', |
| | | 'waitress', |
| | | 'pyramid_chameleon' |
| | | ] |
| | | |
| | |
| | | pyramid_debugtoolbar |
| | | |
| | | [server:main] |
| | | use = egg:pyramid#wsgiref |
| | | port = 6543 |
| | | use = egg:waitress#main |
| | | listen = localhost:6543 |
| | |
| | | |
| | | requires = [ |
| | | 'pyramid', |
| | | 'waitress', |
| | | 'pyramid_chameleon', |
| | | ] |
| | | |
| | |
| | | pyramid_debugtoolbar |
| | | |
| | | [server:main] |
| | | use = egg:pyramid#wsgiref |
| | | port = 6543 |
| | | use = egg:waitress#main |
| | | listen = localhost:6543 |
| | |
| | | |
| | | requires = [ |
| | | 'pyramid', |
| | | 'waitress', |
| | | ] |
| | | |
| | | setup(name='tutorial', |
| | |
| | | pyramid_debugtoolbar |
| | | |
| | | [server:main] |
| | | use = egg:pyramid#wsgiref |
| | | port = 6543 |
| | | use = egg:waitress#main |
| | | listen = localhost:6543 |
| | |
| | | |
| | | requires = [ |
| | | 'pyramid', |
| | | 'waitress', |
| | | 'pyramid_chameleon' |
| | | ] |
| | | |
| | |
| | | pyramid_debugtoolbar |
| | | |
| | | [server:main] |
| | | use = egg:pyramid#wsgiref |
| | | port = 6543 |
| | | use = egg:waitress#main |
| | | listen = localhost:6543 |
| | |
| | | |
| | | requires = [ |
| | | 'pyramid', |
| | | 'waitress', |
| | | ] |
| | | |
| | | setup(name='tutorial', |