diff options
Diffstat (limited to 'docs/quick_tutorial/ini.rst')
| -rw-r--r-- | docs/quick_tutorial/ini.rst | 69 |
1 files changed, 31 insertions, 38 deletions
diff --git a/docs/quick_tutorial/ini.rst b/docs/quick_tutorial/ini.rst index ce92914fe..0bb7da1ba 100644 --- a/docs/quick_tutorial/ini.rst +++ b/docs/quick_tutorial/ini.rst @@ -11,19 +11,16 @@ simpler, better application running. Background ========== -Pyramid has a first-class concept of :ref:`configuration <configuration_narr>` -distinct from code. This approach is optional, but its presence makes it -distinct from other Python web frameworks. It taps into Python's ``setuptools`` -library, which establishes conventions for installing and providing "entry -points" for Python projects. Pyramid uses an entry point to let a Pyramid -application know where to find the WSGI app. +Pyramid has a first-class concept of :ref:`configuration <configuration_narr>` distinct from code. +This approach is optional, but its presence makes it distinct from other Python web frameworks. +It taps into Python's :term:`Setuptools` library, which establishes conventions for installing and providing ":term:`entry point`\ s" for Python projects. +Pyramid uses an :term:`entry point` to let a Pyramid application know where to find the WSGI app. Objectives ========== -- Modify our ``setup.py`` to have an entry point telling Pyramid the location - of the WSGI app. +- Modify our ``setup.py`` to have an :term:`entry point` telling Pyramid the location of the WSGI app. - Create an application driven by an ``.ini`` file. @@ -35,50 +32,48 @@ Objectives Steps ===== -#. First we copy the results of the previous step: +#. First we copy the results of the previous step: - .. code-block:: bash + .. code-block:: bash - cd ..; cp -r package ini; cd ini + cd ..; cp -r package ini; cd ini -#. Our ``ini/setup.py`` needs a setuptools "entry point" in the ``setup()`` - function: +#. Our ``ini/setup.py`` needs a :term:`Setuptools` :term:`entry point` in the ``setup()`` function: - .. literalinclude:: ini/setup.py - :linenos: + .. literalinclude:: ini/setup.py + :linenos: + :emphasize-lines: 13-17 -#. We can now install our project, thus generating (or re-generating) an "egg" - at ``ini/tutorial.egg-info``: +#. We can now install our project, thus generating (or re-generating) an "egg" at ``ini/tutorial.egg-info``: - .. code-block:: bash + .. code-block:: bash - $VENV/bin/pip install -e . + $VENV/bin/pip install -e . -#. Let's make a file ``ini/development.ini`` for our configuration: +#. Let's make a file ``ini/development.ini`` for our configuration: - .. literalinclude:: ini/development.ini - :language: ini - :linenos: + .. literalinclude:: ini/development.ini + :language: ini + :linenos: -#. We can refactor our startup code from the previous step's ``app.py`` into - ``ini/tutorial/__init__.py``: +#. We can refactor our startup code from the previous step's ``app.py`` into ``ini/tutorial/__init__.py``: - .. literalinclude:: ini/tutorial/__init__.py - :linenos: + .. literalinclude:: ini/tutorial/__init__.py + :linenos: -#. Now that ``ini/tutorial/app.py`` isn't used, let's remove it: +#. Now that ``ini/tutorial/app.py`` isn't used, let's remove it: - .. code-block:: bash + .. code-block:: bash - rm tutorial/app.py + rm tutorial/app.py -#. Run your Pyramid application with: +#. Run your Pyramid application with: - .. code-block:: bash + .. code-block:: bash - $VENV/bin/pserve development.ini --reload + $VENV/bin/pserve development.ini --reload -#. Open http://localhost:6543/. +#. Open http://localhost:6543/. Analysis ======== @@ -89,8 +84,7 @@ application. Processing then proceeds as described in the Pyramid chapter on - ``pserve`` looks for ``[app:main]`` and finds ``use = egg:tutorial``. -- The projects's ``setup.py`` has defined an "entry point" (lines 10-13) for the - project's "main" entry point of ``tutorial:main``. +- The projects's ``setup.py`` has defined an :term:`entry point` (lines 10-13) for the project's "main" :term:`entry point` of ``tutorial:main``. - The ``tutorial`` package's ``__init__`` has a ``main`` function. @@ -133,8 +127,7 @@ Extra credit #. Can we have multiple ``.ini`` configuration files for a project? Why might you want to do that? -#. The entry point in ``setup.py`` didn't mention ``__init__.py`` when it - declared ``tutorial:main`` function. Why not? +#. The :term:`entry point` in ``setup.py`` didn't mention ``__init__.py`` when it declared ``tutorial:main`` function. Why not? #. What is the purpose of ``**settings``? What does the ``**`` signify? |
