diff options
| -rw-r--r-- | docs/glossary.rst | 12 | ||||
| -rw-r--r-- | docs/narr/advconfig.rst | 8 | ||||
| -rw-r--r-- | docs/narr/logging.rst | 1 | ||||
| -rw-r--r-- | docs/narr/project.rst | 20 | ||||
| -rw-r--r-- | docs/narr/startup.rst | 27 |
5 files changed, 47 insertions, 21 deletions
diff --git a/docs/glossary.rst b/docs/glossary.rst index f42b298df..7f396dc7d 100644 --- a/docs/glossary.rst +++ b/docs/glossary.rst @@ -1207,3 +1207,15 @@ Glossary route prefix A route prefix is a path prefix that is prepended to any routes that are configured while it is active. A route prefix can be set via :meth:`pyramid.config.Configurator.include` or :meth:`pyramid.config.Configurator.route_prefix_context`. + + commit + An operation applied to a :term:`configurator`. + A commit checks for conflicts in :term:`configuration declaration`\s, and if none are found applies all pending :term:`action`\s. + It is possible, although not necessarily recommended, to invoke :term:`commit`\s using :meth:`pyramid.config.Configurator.commit` to :ref:`manually resolve <manually_resolving_conflicts>` configuration conflicts. + + settings + Settings control the runtime behavior of a Pyramid application. + They are the aggregation of configuration file declarations, process environment values, other additions generated by Pyramid or its add-ons and :term:`tween`\s, and values produced by your own code. + Settings are collected at application startup. + They can affect all the components which make up the the application. + Pyramid itself, any tweens or Pyramid add-ons used, and :ref:`your own code may reference <deployment_settings>` and act on settings. diff --git a/docs/narr/advconfig.rst b/docs/narr/advconfig.rst index 322741648..33edb0eae 100644 --- a/docs/narr/advconfig.rst +++ b/docs/narr/advconfig.rst @@ -168,9 +168,13 @@ Using ``config.commit()`` You can manually commit a configuration by using the :meth:`~pyramid.config.Configurator.commit` method between configuration calls. +After a commit, more :term:`configuration declaration`\s may be added to a :term:`configurator`. +New declarations will not conflict with committed declarations. +The new declarations will override committed declarations. + For example, we prevent conflicts from occurring in the application we examined -previously as the result of adding a ``commit``. Here's the application that -generates conflicts: +previously by adding a ``commit``. +Here's the application that generates conflicts: .. code-block:: python :linenos: diff --git a/docs/narr/logging.rst b/docs/narr/logging.rst index 7b60beda9..2acdb33f4 100644 --- a/docs/narr/logging.rst +++ b/docs/narr/logging.rst @@ -32,6 +32,7 @@ you to send messages to :mod:`Python standard library logging package :term:`PasteDeploy` ``development.ini`` and ``production.ini`` files created when you use our cookiecutter include a basic configuration for the Python :mod:`logging` package. +These ``.ini`` file sections are passed to the `logging module's config file configuration engine <https://docs.python.org/3.7/howto/logging.html#configuring-logging>`_. PasteDeploy ``.ini`` files use the Python standard library :mod:`ConfigParser format <ConfigParser>`. This is the same format used as the Python diff --git a/docs/narr/project.rst b/docs/narr/project.rst index 725263407..14f0d083e 100644 --- a/docs/narr/project.rst +++ b/docs/narr/project.rst @@ -139,8 +139,8 @@ or install your application for deployment or development. An ``.ini`` file named ``development.ini`` will be created in the project directory. You will use this ``.ini`` file to configure a server, to run your -application, and to debug your application. It contains configuration that -enables an interactive debugger and settings optimized for development. +application, and to debug your application. +It contains configuration that enables an interactive debugger and :term:`settings` optimized for development. Another ``.ini`` file named ``production.ini`` will also be created in the project directory. It contains configuration that disables any interactive @@ -297,7 +297,7 @@ path to the module on which we want to run tests and coverage. single: running an application single: pserve single: reload - single: startup + single: starting .. _running_the_project_application: @@ -658,12 +658,10 @@ only (``127.0.0.1``). .. _myproject_ini_logging: The sections after ``# logging configuration`` represent Python's standard -library :mod:`logging` module configuration for your application. These -sections are passed to the `logging module's config file configuration engine -<https://docs.python.org/2/howto/logging.html#configuring-logging>`_ when the -``pserve`` or ``pshell`` commands are executed. The default configuration +library :mod:`logging` module configuration for your application. +The default configuration sends application logging output to the standard error output of your terminal. -For more information about logging configuration, see :ref:`logging_chapter`. +For more information see :ref:`logging_chapter`. See the :term:`PasteDeploy` documentation for more information about other types of things you can put into this ``.ini`` file, such as other @@ -856,7 +854,7 @@ also informs Python that the directory which contains it is a *package*. WSGI application. This function is meant to be called by the :term:`PasteDeploy` framework as a result of running ``pserve``. - Within this function, application configuration is performed. + The ``main`` function configures the application. Line 7 opens a context manager with an instance of a :term:`Configurator`. @@ -871,6 +869,10 @@ also informs Python that the directory which contains it is a *package*. Line 11 returns a :term:`WSGI` application to the caller of the function (Pyramid's pserve). +.. seealso:: + + See :ref:`the_startup_process` for more about the application's :ref:`settings <startup_settings>` and ``main``\'s :ref:`arguments <startup_constructor_arguments>` and statements. + .. index:: single: routes.py diff --git a/docs/narr/startup.rst b/docs/narr/startup.rst index 90792c0ff..17926c716 100644 --- a/docs/narr/startup.rst +++ b/docs/narr/startup.rst @@ -21,6 +21,8 @@ on your keyboard after typing ``pserve development.ini`` and the time the lines single: startup process pair: settings; .ini +.. _the_startup_process: + The Startup Process ------------------- @@ -81,6 +83,12 @@ Here's a high-level time-ordered overview of what happens when you press :language: python :linenos: + .. index:: + single: ini file + pair: PasteDeploy; configuration + + .. _startup_constructor_arguments: + Note that the constructor function accepts a ``global_config`` argument, which is a dictionary of key/value pairs mentioned in the ``[DEFAULT]`` section of an ``.ini`` file (if :ref:`[DEFAULT] @@ -106,15 +114,17 @@ Here's a high-level time-ordered overview of what happens when you press pyramid.includes = pyramid_debugtoolbar}``. See :ref:`environment_chapter` for the meanings of these keys. -#. The ``main`` function first constructs a - :class:`~pyramid.config.Configurator` instance, passing the ``settings`` - dictionary captured via the ``**settings`` kwarg as its ``settings`` - argument. +#. The ``main`` function begins by making a :term:`configurator`. + The dictionary captured via the ``**settings`` kwarg is passed to the :class:`~pyramid.config.Configurator` constructor in its ``settings`` argument. + The new configurator holds the application's :term:`settings` and is able to :term:`commit` any :term:`configuration declaration`\s the settings contain. + + .. _startup_settings: The ``settings`` dictionary contains all the options in the ``[app:main]`` section of our .ini file except the ``use`` option (which is internal to PasteDeploy) such as ``pyramid.reload_templates``, ``pyramid.debug_authorization``, etc. + It is :ref:`available for use <deployment_settings>` in your code. #. The ``main`` function then calls various methods on the instance of the class :class:`~pyramid.config.Configurator` created in the previous step. @@ -158,9 +168,6 @@ Here's a high-level time-ordered overview of what happens when you press Deployment Settings ------------------- -Note that an augmented version of the values passed as ``**settings`` to the -:class:`~pyramid.config.Configurator` constructor will be available in -:app:`Pyramid` :term:`view callable` code as ``request.registry.settings``. You -can create objects you wish to access later from view code, and put them into -the dictionary you pass to the configurator as ``settings``. They will then be -present in the ``request.registry.settings`` dictionary at application runtime. +Note that an augmented version of the values passed as ``**settings`` to the :class:`~pyramid.config.Configurator` constructor is available in :app:`Pyramid` :term:`view callable` code as ``request.registry.settings``. +You can create objects you wish to access later from view code, and put them into the dictionary you pass to the configurator as ``settings``. +They will then be present in the ``request.registry.settings`` dictionary at application runtime. |
